Closed FelixSchwarz closed 2 years ago
Just some quick comments:
PyCode_New
but code_new
. I have a local commit which adds some docs for that.CodeType(**kwargs)
it seems like we need to use positional parameters only (Python 3.10 error message: TypeError: code() takes no keyword arguments
).
initially reported by @ztane in https://github.com/edgewall/genshi/issues/43#issuecomment-955814422
I think this does not affect Genshi on Python 3.8+ as we are using
.replace()
there but it still is a bug in Genshi.Current Genshi code for Python 3: https://github.com/edgewall/genshi/blob/a23f3054b96b487215b04812c680075c5117470a/genshi/compat.py#L109-L113
Actual constructor arguments in CPython 3.5: https://github.com/python/cpython/blob/7544508f0245173bff5866aa1598c8f6cce1fc5f/Lib/types.py#L60-L65
Constructor for CPython 3.11 referenced in https://github.com/edgewall/genshi/issues/43#issuecomment-845491080
Genshi code Python 2: https://github.com/edgewall/genshi/blob/a23f3054b96b487215b04812c680075c5117470a/genshi/compat.py#L91-L94
Maybe I'm just confused right now but it seems the Python 2 constructor does not use the correct ordering as well: https://github.com/python/cpython/blob/3bbd2fad4d4a282c7a5a3169a4f497b97aeff319/Objects/codeobject.c#L50-L56
For Python 3 the constructor using positional parameters only is marked as "deprecated" so maybe we should use keyword parameters only.