-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix tools.codegenerator
for NameError
and AttributeError
in generated modules.
#294
fix tools.codegenerator
for NameError
and AttributeError
in generated modules.
#294
Conversation
comtypes/tools/codegenerator.py
Outdated
from collections import OrderedDict | ||
self.data = OrderedDict() | ||
|
||
def add(self, *names, symbols=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax (*names
and further keyword args) is not Py2.7 compatible. I still want to keep it for pywinauto project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this py27-compatible.
P.S.
*names, symbols=None
syntax was not failed in AppVeyor CI.
Perhaps, some tests are broken.
IMO release of 1.1.13 should wait until tests were fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comtypes
AppVeyor tests are very limited. There are only 2 install tests. The vast majority of functional tests are not enabled in AppVeyor for now. I've detected this Py2.7 issue on pywinauto tests (on pywinauto's AppVeyior). If they pass, I'm probably going to merge this PR. Thanks for your efforts!
I fixed class name case( |
#293
Fix
NameError
andAttributeError
in generated modules.Relationship with #287
I PRed #287 to fix lack of
from ctypes import *
line in generated modules(#284).But another problem in namespaces of generated modules(#293).
This PR fixes both problems.
Note for changes
Add
ImportedNamespaces
andDeclaredNamespaces
They will be
Generator
attribute instead ofdict
orio.StringIO
.Formerly, to avoid duplicating import and alias-declaring lines,
Generator._Foo_defined
attributes are necessary.With this change,
ImportedNamespaces
andDeclaredNamespaces
prevent duplication of generated modules' lines instead ofGenerator
itself.self.output
is used only whenGenerator.generate_code
was calledFormerly, many I/O(
self.output
,self.declarations
,self.stream
) and writing/printing to them are messy and will be a root of weird bugs.With this change,
self.stream
is the I/O that will be mainly used andself.output
is used only inGenerator.generate_code
.