Skip to content

Commit 41f4b91

Browse files
DinoVfacebook-github-bot
authored andcommitted
Fix const added for doc string
Summary: The initial const that's added for the doc string has become a little simpler. Reviewed By: alexmalyshev Differential Revision: D80763696 fbshipit-source-id: f2aa17b36c1a0d959d3d8e2017f22bceecbd0d05
1 parent 1a443aa commit 41f4b91

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cinderx/PythonLib/cinderx/compiler/pyassem.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,6 +2285,14 @@ def flatten_jump(self, inst: Instruction, pc: int) -> int:
22852285
">=": COMPARISON_GREATER_THAN | COMPARISON_EQUALS,
22862286
}
22872287

2288+
def initializeConsts(self) -> None:
2289+
# Docstring is first entry in co_consts for normal functions
2290+
# (Other types of code objects deal with docstrings in different
2291+
# manner, e.g. lambdas and comprehensions don't have docstrings,
2292+
# classes store them as __doc__ attribute.
2293+
if self.docstring is not None and not self.klass:
2294+
self.consts[self.get_const_key(self.docstring)] = 0
2295+
22882296
def _convert_compare_op(self: PyFlowGraph, arg: object) -> int:
22892297
# cmp goes in top three bits of the oparg, while the low four bits are used
22902298
# by quickened versions of this opcode to store the comparison mask. The

0 commit comments

Comments
 (0)