@@ -1398,49 +1398,94 @@ if sys.version_info >= (3, 10):
13981398# compile() returns a CodeType, unless the flags argument includes PyCF_ONLY_AST (=1024),
13991399# in which case it returns ast.AST. We have overloads for flag 0 (the default) and for
14001400# explicitly passing PyCF_ONLY_AST. We fall back to Any for other values of flags.
1401- @overload
1402- def compile (
1403- source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1404- filename : str | ReadableBuffer | PathLike [Any ],
1405- mode : str ,
1406- flags : Literal [0 ],
1407- dont_inherit : bool = False ,
1408- optimize : int = - 1 ,
1409- * ,
1410- _feature_version : int = - 1 ,
1411- ) -> CodeType : ...
1412- @overload
1413- def compile (
1414- source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1415- filename : str | ReadableBuffer | PathLike [Any ],
1416- mode : str ,
1417- * ,
1418- dont_inherit : bool = False ,
1419- optimize : int = - 1 ,
1420- _feature_version : int = - 1 ,
1421- ) -> CodeType : ...
1422- @overload
1423- def compile (
1424- source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1425- filename : str | ReadableBuffer | PathLike [Any ],
1426- mode : str ,
1427- flags : Literal [1024 ],
1428- dont_inherit : bool = False ,
1429- optimize : int = - 1 ,
1430- * ,
1431- _feature_version : int = - 1 ,
1432- ) -> _ast .AST : ...
1433- @overload
1434- def compile (
1435- source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1436- filename : str | ReadableBuffer | PathLike [Any ],
1437- mode : str ,
1438- flags : int ,
1439- dont_inherit : bool = False ,
1440- optimize : int = - 1 ,
1441- * ,
1442- _feature_version : int = - 1 ,
1443- ) -> Any : ...
1401+ if sys .version_info >= (3 , 12 ):
1402+ @overload
1403+ def compile (
1404+ source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1405+ filename : str | bytes | PathLike [Any ],
1406+ mode : str ,
1407+ flags : Literal [0 ],
1408+ dont_inherit : bool = False ,
1409+ optimize : int = - 1 ,
1410+ * ,
1411+ _feature_version : int = - 1 ,
1412+ ) -> CodeType : ...
1413+ @overload
1414+ def compile (
1415+ source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1416+ filename : str | bytes | PathLike [Any ],
1417+ mode : str ,
1418+ * ,
1419+ dont_inherit : bool = False ,
1420+ optimize : int = - 1 ,
1421+ _feature_version : int = - 1 ,
1422+ ) -> CodeType : ...
1423+ @overload
1424+ def compile (
1425+ source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1426+ filename : str | bytes | PathLike [Any ],
1427+ mode : str ,
1428+ flags : Literal [1024 ],
1429+ dont_inherit : bool = False ,
1430+ optimize : int = - 1 ,
1431+ * ,
1432+ _feature_version : int = - 1 ,
1433+ ) -> _ast .AST : ...
1434+ @overload
1435+ def compile (
1436+ source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1437+ filename : str | bytes | PathLike [Any ],
1438+ mode : str ,
1439+ flags : int ,
1440+ dont_inherit : bool = False ,
1441+ optimize : int = - 1 ,
1442+ * ,
1443+ _feature_version : int = - 1 ,
1444+ ) -> Any : ...
1445+ else :
1446+ @overload
1447+ def compile (
1448+ source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1449+ filename : str | ReadableBuffer | PathLike [Any ],
1450+ mode : str ,
1451+ flags : Literal [0 ],
1452+ dont_inherit : bool = False ,
1453+ optimize : int = - 1 ,
1454+ * ,
1455+ _feature_version : int = - 1 ,
1456+ ) -> CodeType : ...
1457+ @overload
1458+ def compile (
1459+ source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1460+ filename : str | ReadableBuffer | PathLike [Any ],
1461+ mode : str ,
1462+ * ,
1463+ dont_inherit : bool = False ,
1464+ optimize : int = - 1 ,
1465+ _feature_version : int = - 1 ,
1466+ ) -> CodeType : ...
1467+ @overload
1468+ def compile (
1469+ source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1470+ filename : str | ReadableBuffer | PathLike [Any ],
1471+ mode : str ,
1472+ flags : Literal [1024 ],
1473+ dont_inherit : bool = False ,
1474+ optimize : int = - 1 ,
1475+ * ,
1476+ _feature_version : int = - 1 ,
1477+ ) -> _ast .AST : ...
1478+ @overload
1479+ def compile (
1480+ source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1481+ filename : str | ReadableBuffer | PathLike [Any ],
1482+ mode : str ,
1483+ flags : int ,
1484+ dont_inherit : bool = False ,
1485+ optimize : int = - 1 ,
1486+ * ,
1487+ _feature_version : int = - 1 ,
1488+ ) -> Any : ...
14441489
14451490copyright : _sitebuiltins ._Printer
14461491credits : _sitebuiltins ._Printer
0 commit comments