Skip to content

duckdb Python Extension Analysis Report #408

Closed

Description

@devdanzin

What happens?

I ran cext-review-toolkit on duckdb-python and got a report with some issues:

The primary risks are: (1) Python API calls without GIL in the parallel numpy scan path (data corruption/crash), (2) PyTuple_Pack reference leak in map.cpp (~11 KB/call), (3) unchecked PyNumber_Rshift NULL in 128-bit integer conversion (segfault), (4) PyErr_PrintEx clobbering exceptions in map and filesystem, and (5) UDF exception handling that optionally swallows MemoryError/KeyboardInterrupt.

The full report is available at https://gist.github.com/devdanzin/5c7600153c8e76afee3ef1a2d516ad70

To Reproduce

Some reproducers are available in the Reproducers Appencix.

OS:

Linux x86_64

DuckDB Package Version:

1.5.1

Python Version:

3.14.3+ debug build

Full Name:

Daniel Silva Diniz

Affiliation:

None

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration to reproduce the issue?

  • Yes, I have

Activity

  1. added a commit that references this issue on Oct 17, 2026
    e7a3786
  2. evertlammerts commented on Oct 19, 2026

    @evertlammerts
    Member

    Thanks. On the 2.0 branch the int conversion no longer calls a subclass's __rshift__, return_null forwards MemoryError and KeyboardInterrupt, the map.cpp tuple leak is gone and the pandas string scan holds the GIL. I verified the first two against 1.5.6 and the current dev build. One finding is still open: rel.map prints the traceback and raises a generic InvalidInputException instead of chaining your exception. I will track that one separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions