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 some issues with six dependency #240
Conversation
Add a fallback for `six.raise_from`, which isn't available in six 1.4.0. It isn't available until six 1.9.0. We could also have raised the lower bound for the six requirement, but this is an easy way to allow clients to keep using their existing versions of six. Fix support for the latest version of six, 1.11.0. That release changed the temporary metaclass returned from `with_metaclass()`, such that it directly inherits from `type`, instead of inheriting from the target metaclass [1]. We depended on this detail, and the change caused .. code-block:: python TypeError('metaclass conflict: ...') to be raised when defining a class with `with_metaclass()`. We fix this by manually selecting the most derived metaclass, and including it in our temporary metaclass. Also, `__prepare__` is now defined on the temporary metaclass, in six 1.11.0 [2]. This allows us to skip our own definition of that method, when using six>=1.11.0. Fixes #228. Fixes #239. [1] <benjaminp/six#191> [2] <benjaminp/six#178>
Verified that @jmoldow has signed the CLA. Thanks for the pull request! |
If we're going to reimplement |
@Jeff-Meadows I didn't want to simply redefine it, because then we'd have code that is identical to what appears in six, and I don't want to get into any licensing grey areas. I think the way it is is okay. In Python 2, there is no difference. In Python 3, the only difference is the My personal preference would be:
I'd be okay with not using But since six 1.9.0 is over two years old, and since we're doing a major version bump, I guess I'd be fine changing this to increase the minimum version, if we don't want to do weird things like redefine a partially-implemented |
@jmoldow I'd rather not reimplement than partially reimplement. I think bumping the minimum to |
Bumped the minimum to 1.9.0. |
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.
Can you also bump the requirement in requirements.txt?
I removed the entries from requirements.txt, since I don't believe there is anything gained from duplicating everything. |
Add a fallback for
six.raise_from
, which isn't available insix 1.4.0. It isn't available until six 1.9.0. We could also
have raised the lower bound for the six requirement, but this is
an easy way to allow clients to keep using their existing
versions of six.
Fix support for the latest version of six, 1.11.0. That release
changed the temporary metaclass returned from
with_metaclass()
, such that it directly inherits fromtype
,instead of inheriting from the target metaclass [1]. We depended
on this detail, and the change caused
.. code-block:: python
to be raised when defining a class with
with_metaclass()
. Wefix this by manually selecting the most derived metaclass, and
including it in our temporary metaclass.
Also,
__prepare__
is now defined on the temporary metaclass,in six 1.11.0 [2]. This allows us to skip our own definition of that
method, when using six>=1.11.0.
Fixes #228.
Fixes #239.
[1] benjaminp/six#191
[2] benjaminp/six#178