Commit a805803
gh-157384: Accept non-ASCII names in PyImport_CreateModuleFromInitfunc()
The builtin loader info encoded the module name as ASCII, so a
non-ASCII spec name failed with UnicodeEncodeError even for multi-phase
init modules, which support such names when loaded dynamically. Fall
back to UTF-8 and mark the name as non-ASCII, so that multi-phase init
works and single-phase init is rejected with the same error as for
dynamically loaded extensions.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HoZE3WdRWQshvinfBZ137N1 parent 2cd6d4b commit a805803
4 files changed
Lines changed: 80 additions & 3 deletions
File tree
- Lib/test
- Misc/NEWS.d/next/C_API
- Programs
- Python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
281 | 284 | | |
282 | 285 | | |
283 | 286 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2410 | 2410 | | |
2411 | 2411 | | |
2412 | 2412 | | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
2413 | 2450 | | |
2414 | 2451 | | |
2415 | 2452 | | |
| |||
2425 | 2462 | | |
2426 | 2463 | | |
2427 | 2464 | | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
2428 | 2473 | | |
2429 | 2474 | | |
2430 | 2475 | | |
| |||
2472 | 2517 | | |
2473 | 2518 | | |
2474 | 2519 | | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
2475 | 2525 | | |
2476 | 2526 | | |
2477 | 2527 | | |
| |||
2491 | 2541 | | |
2492 | 2542 | | |
2493 | 2543 | | |
2494 | | - | |
| 2544 | + | |
| 2545 | + | |
2495 | 2546 | | |
2496 | 2547 | | |
2497 | 2548 | | |
| |||
2502 | 2553 | | |
2503 | 2554 | | |
2504 | 2555 | | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
2505 | 2563 | | |
2506 | 2564 | | |
2507 | 2565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
161 | 166 | | |
162 | 167 | | |
163 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
164 | 177 | | |
165 | 178 | | |
166 | 179 | | |
| |||
169 | 182 | | |
170 | 183 | | |
171 | 184 | | |
172 | | - | |
| 185 | + | |
173 | 186 | | |
174 | 187 | | |
175 | 188 | | |
| |||
0 commit comments