We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have been trying to 'pickle' instances of "WebFeatureService_1_1_0", but this is difficult because the code calls __init__ from within __new__.
When unpickling the object, 'pickle' calls __new__ to create the instance
(From https://docs.python.org/3/library/pickle.html#pickling-class-instances)
def load(cls, attributes): obj = cls.__new__(cls) obj.__dict__.update(attributes) return obj
then because this calls __init__, it tries to fully re-create the object, which makes the use of pickle pointless!
In the end, I had to override WebFeatureService_1_1_0.__new__ with one that does not call __init__ to get pickle to work.
Also I understand that python calls __new__ then calls __init__ when creating objects, (https://docs.python.org/3/reference/datamodel.html#object.__new__)
This means that __init__ is called twice!
Is this a bug, or is there a good reason for calling __init__ from within __new__?
If it is a bug, I'd be happy to submit a pull request for this and the other WFS versions.
The text was updated successfully, but these errors were encountered:
This Issue has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days.
Sorry, something went wrong.
This Issue has been closed due to there being no activity for more than 90 days.
Resolved with #548
No branches or pull requests
I have been trying to 'pickle' instances of "WebFeatureService_1_1_0", but this is difficult because the code calls __init__ from within __new__.
When unpickling the object, 'pickle' calls __new__ to create the instance
(From https://docs.python.org/3/library/pickle.html#pickling-class-instances)
def load(cls, attributes):
obj = cls.__new__(cls)
obj.__dict__.update(attributes)
return obj
then because this calls __init__, it tries to fully re-create the object, which makes the use of pickle pointless!
In the end, I had to override WebFeatureService_1_1_0.__new__ with one that does not call __init__ to get pickle to work.
Also I understand that python calls __new__ then calls __init__ when creating objects, (https://docs.python.org/3/reference/datamodel.html#object.__new__)
This means that __init__ is called twice!
Is this a bug, or is there a good reason for calling __init__ from within __new__?
If it is a bug, I'd be happy to submit a pull request for this and the other WFS versions.
The text was updated successfully, but these errors were encountered: