Commit cc739fb
sishubha
Fix Stubgen's behavior for Instance Variables in C extensions
It is not necessary for instance variables to have the fget attrbute
(e.g. instance variable in a C class in an extension) but
inspect.isdatadescriptor return True as expected, hence we update
the 'is_c_property' check.
Since special attributes (like __dict__ etc) also passes 'is_c_property'
check, we ignore all such special attributes in
'generate_c_property_stub' while creating the contents of stub file.
Also, 'is_c_property_readonly' assumed that the property would always
have 'fset' attribute which again is not true for instance variables
in C extension. Hence make the check defensive by first checking if
'fset' attribute even exists or not.
This fixes #12150.1 parent ee0638f commit cc739fb
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
| |||
0 commit comments