USING PYCForge
A diagnostic identifies the source that could not convert and explains why. Start with the first error, make a focused correction, and convert again.
| Code | Check this | Typical correction |
|---|---|---|
PYC4501 | Annotation and assigned value disagree. | Keep one type per variable. Use 1.0 for float; assign declarations before reading them. |
PYC4502 | A constant numeric value is unsupported or out of range. | Keep integer values within signed 64-bit limits and use finite floats. |
PYC4503 | A string contains NUL or cannot be encoded as valid UTF-8. | Use valid Unicode text without embedded NUL characters. |
PYC4504 | Constant expansion exceeded a conversion limit. | Reduce repetitions, expanded strings, or source size. |
PYC4505 | A constant string operation is invalid. | Check index bounds, slice steps, method arguments, and supported methods. |
PYC4506 | An assignment target or unpacking form is unsupported. | Use scalar names and matching flat tuple/list assignments; avoid nested or starred targets. |
PYC4507 | A module value needs unsupported runtime work or mutable state. | Use constant initializers, avoid conflicting names, and pass changing values as function parameters. |
PYC4510 | A string operation received a non-string value. | Keep both operands string-valued on every path. |
| Code or family | Typical issue | Next step |
|---|---|---|
PYC100x | Invalid conversion request or resource setting. | Try the default settings and check the requested limits. |
PYC28xx–PYC29xx | Unsupported function, expression, call, return, or variable use. | Read the specific message and the matching reference page. |
PYC2940 | A variable may be read before assignment. | Initialize it before use on every continuing path. |
PYC2941 | A loop variable is used where it may not exist. | Initialize a separate result before the loop. |
PYC2943 | A variable changes type. | Use a consistent type in all assignments and branches. |
PYC34xx | Unsupported container form or use. | Check Containers and records. |
PYC35xx | Missing module, unsupported import, or conflicting name. | Add the required source file and use a direct function import. |
PYC36xx | Unsupported record class or field access. | Use the exact simple record example. |
PYC9xxx | Internal conversion error. | Save a minimal example, the exact message, and the installed version for a bug report. |
Use 1–64 unique literals of one numeric or Boolean type. Assign the set to a local name and use that name for membership checks. PYC3411 reports unsupported set indexing; PYC3412 reports unsupported set iteration. Use an ordered list or tuple when your program needs indexing or iteration.
| Code | Typical correction |
|---|---|
PYC3901 | Use one direct function-body with open statement per session. |
PYC3902 | Do not reassign the built-in name open. |
PYC3903 | Check path, literal mode, encoding='utf-8', and newline=''. |
PYC3904 | Give the handle a fresh local name. |
PYC3905 | Use one supported read or write and the documented return form. |
PYC3906 | Do not alias the handle or use it after the with; return a read value as documented. |
PYC3907 | Reduce the number of file operations. |
PYC3908 | Call file-access functions from the C caller, rather than another converted Python function. |
Errors when the generated C runs use numeric status values instead. See Check file errors from C.
If a result includes warnings, review them before using the generated C.