Mercurial > cpython-lru_cache-weakref
comparison Python/symtable.c @ 35759:d91ed7107fd2 legacy-trunk
ANSI-C-ify the placement of local var declarations.
| author | Armin Rigo <arigo@tunes.org> |
|---|---|
| date | Fri, 21 Oct 2005 12:57:31 +0000 |
| parents | 1c4d192f1568 |
| children | 34ef9f138c30 |
comparison
equal
deleted
inserted
replaced
| 35758:e0e320f36c93 | 35759:d91ed7107fd2 |
|---|---|
| 442 | 442 |
| 443 /* Check for illegal statements in unoptimized namespaces */ | 443 /* Check for illegal statements in unoptimized namespaces */ |
| 444 static int | 444 static int |
| 445 check_unoptimized(const PySTEntryObject* ste) { | 445 check_unoptimized(const PySTEntryObject* ste) { |
| 446 char buf[300]; | 446 char buf[300]; |
| 447 const char* trailer; | |
| 447 | 448 |
| 448 if (ste->ste_type == ModuleBlock || !ste->ste_unoptimized | 449 if (ste->ste_type == ModuleBlock || !ste->ste_unoptimized |
| 449 || !(ste->ste_free || ste->ste_child_free)) | 450 || !(ste->ste_free || ste->ste_child_free)) |
| 450 return 1; | 451 return 1; |
| 451 | 452 |
| 452 const char* trailer = (ste->ste_child_free ? | 453 trailer = (ste->ste_child_free ? |
| 453 "contains a nested function with free variables" : | 454 "contains a nested function with free variables" : |
| 454 "is a nested function"); | 455 "is a nested function"); |
| 455 | 456 |
| 456 switch (ste->ste_unoptimized) { | 457 switch (ste->ste_unoptimized) { |
| 457 case OPT_TOPLEVEL: /* exec / import * at top-level is fine */ | 458 case OPT_TOPLEVEL: /* exec / import * at top-level is fine */ |
| 619 } | 620 } |
| 620 | 621 |
| 621 /* Recursively call analyze_block() on each child block */ | 622 /* Recursively call analyze_block() on each child block */ |
| 622 for (i = 0; i < PyList_GET_SIZE(ste->ste_children); ++i) { | 623 for (i = 0; i < PyList_GET_SIZE(ste->ste_children); ++i) { |
| 623 PyObject *c = PyList_GET_ITEM(ste->ste_children, i); | 624 PyObject *c = PyList_GET_ITEM(ste->ste_children, i); |
| 625 PySTEntryObject* entry; | |
| 624 assert(c && PySTEntry_Check(c)); | 626 assert(c && PySTEntry_Check(c)); |
| 625 PySTEntryObject* entry = (PySTEntryObject*)c; | 627 entry = (PySTEntryObject*)c; |
| 626 if (!analyze_block(entry, newbound, newfree, newglobal)) | 628 if (!analyze_block(entry, newbound, newfree, newglobal)) |
| 627 goto error; | 629 goto error; |
| 628 if (entry->ste_free || entry->ste_child_free) | 630 if (entry->ste_free || entry->ste_child_free) |
| 629 ste->ste_child_free = 1; | 631 ste->ste_child_free = 1; |
| 630 } | 632 } |
