GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Segfault when an optional value is passed to a Python-implemented function · Issue #113 · cel-expr/cel-python

Segfault when an optional value is passed to a Python-implemented function #113

New issue
Copy link
New issue
Copy link
Open
Open
Segfault when an optional value is passed to a Python-implemented function#113
Copy link
Assignees
dmitriplotnikov

Description

@sfodje-ship
sfodje-ship
opened on Oct 7, 2026
Issue body actions

What happens

Passing a CEL optional to a function whose overload has a Python impl
kills the process (SIGSEGV, exit 139) before the function is called. The same
happens when the argument is a map holding an optional. A Python try cannot
catch it.

Reproduce

import sys
from cel_expr_python import cel
from cel_expr_python.ext import ext_optional

def show(x):
    return "ok"

env = cel.NewEnv(
    variables={"m": cel.Type.DYN},
    extensions=[ext_optional.ExtOptional()],
    functions=[cel.FunctionDecl("show", [
        cel.Overload("show_any", cel.Type.STRING, [cel.Type("any")], impl=show),
    ])],
)
act = env.Activation({"m": {"a": 1}})
print(env.compile("show(m)").eval(act).value(), flush=True)      # ok
print(env.compile(sys.argv[1]).eval(act).value(), flush=True)
Expression Result
show(m[?'a']) exit 139
show(optional.of(1)) exit 139
show({'k': optional.of(1)}) exit 139
show([optional.of(1)]) no crash: UNKNOWN: Unimplemented type: 17

Expected

An evaluation error, as the list case already gives, or the optional handed to
the function as a value.

Likely cause

CelValueToPyObject has no case for an optional and returns null with a
Python error set. PyCelFunctionAdapter::Invoke puts that null into the
argument tuple and calls the function without checking it.

Versions

cel-expr-python 0.1.3 from PyPI, and main at 45eefa7 built from source.
CPython 3.14.6, macOS arm64.

Activity

  1. dmitriplotnikov
    self-assigned this
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dmitriplotnikov
    dmitriplotnikov

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.