Commit 9cf6fa6
Rename hardcoded decorator functions to be non-private
Summary:
Verified that these names weren't meant to be private, just added a prefix to avoid conflicts.
Because inlined decorators generate new functions, this doesn't go through preprocessing a second time to make sure the newly generated (hard coded) function names get mangled properly if they are private.
When testing, the "expected" source is parsed with all expected generated functions already there and so these are mangled when they're named in a way that looks private.
https://docs.python.org/3/reference/expressions.html?highlight=mangling#atom-identifiers
> Private name mangling: When an identifier that textually occurs in a class definition begins with two or more underscore characters and does not end in two or more underscores, it is considered a private name of that class. Private names are transformed to a longer form before code is generated for them. The transformation inserts the class name, with leading underscores removed and a single underscore inserted, in front of the name. For example, the identifier spam occurring in a class named Ham will be transformed to _Hamspam. This transformation is independent of the syntactical context in which the identifier is used.
Could either throw in an exta re-preprocessing of the "actual" source after it's gone through decorator inlining, or just change the way we hardcode the generated names to avoid the name mangling (they're not even methods on the class, so it makes no practical difference). Figured just avoiding the mangling situation is cleaner; unblocks D30146161.
Reviewed By: dkgi
Differential Revision: D30212576
fbshipit-source-id: 2c4b47d91f3e478297fe68ae55413f8bbaced6b11 parent 592ad6d commit 9cf6fa6
File tree
8 files changed
+424
-428
lines changed- source
- interprocedural_analyses/taint/test/integration
- interprocedural
- test
- new_server/test
- server/test
8 files changed
+424
-428
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
| 529 | + | |
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
| 546 | + | |
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| |||
0 commit comments