3.12+: compile()
and some wrappers of it don't accept non-bytes buffers for filename argument at runtime
#13881
Labels
stubs: false negative
Type checkers do not report an error, but should
The underlying C API that
compile()
uses to convert/validate its filename argument,PyUnicode_FSConverter
, doesn't accept non-bytes buffers anymore (see python/cpython#98393), but typeshed still has that parameter typed with(collections.abc|typing_extensions).Buffer
instead ofbytes
. Having a 3.12+ versionif
branch for the updated function definition would make sense, imo.Min. Repro. Example
At the moment, I can think of a few stdlib functions that pass a filename argument through to
compile()
and thus also need to be updated:ast.parse()
importlib.machinery.SourceFileLoader.source_to_code()
(maybe also the corresponding methods in its base classes?)Not sure what else is affected by this deprecation-turned-error, but there might be more.
The text was updated successfully, but these errors were encountered: