Skip to content
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

bpo-10076: Compiled regular expression and match objects now are copy… #1000

Merged
merged 2 commits into from
Apr 16, 2017

Conversation

serhiy-storchaka
Copy link
Member

…able.

@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Apr 5, 2017
@mention-bot
Copy link

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @tiran, @nnorwitz and @Yhg1s to be potential reviewers.

@serhiy-storchaka serhiy-storchaka merged commit fdbd011 into python:master Apr 16, 2017
@serhiy-storchaka serhiy-storchaka deleted the re-copy branch April 16, 2017 07:16
@aarcro
Copy link

aarcro commented Oct 31, 2017

This was not back ported? I'm on 3.6.3 and 3.6.1 and still get "TypeError: cannot deepcopy this pattern object"

@serhiy-storchaka
Copy link
Member Author

This is a new feature and it wasn't backported. You can work around this by registering trivial copiers in copy._copy_dispatch.

copy._copy_dispatch[type(re.compile(''))] = lambda x: x                                                                                                                                                   
copy._copy_dispatch[type(re.match('', ''))] = lambda x: x

This is a hack, do it only for working around limitations of old versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants