diff options
author | Shane Harvey <shane.harvey@mongodb.com> | 2017-08-05 15:01:10 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-08-05 15:01:10 (GMT) |
commit | 4795ba857ef2a89e6b477285df961672106a1792 (patch) | |
tree | 7fcf4caf59fc962aa7171c43878f687fc6916a1e /Lib/copyreg.py | |
parent | a0cb7db8e4b928b4c06da4bde8695555276958f0 (diff) | |
download | cpython-4795ba857ef2a89e6b477285df961672106a1792.zip cpython-4795ba857ef2a89e6b477285df961672106a1792.tar.gz cpython-4795ba857ef2a89e6b477285df961672106a1792.tar.bz2 |
[3.6] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989) (#3003)
(cherry picked from commit c4c9866064f03646c686d7e08b00aeb203c35c19)
Diffstat (limited to 'Lib/copyreg.py')
-rw-r--r-- | Lib/copyreg.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/copyreg.py b/Lib/copyreg.py index 67f5bb0..cef9984 100644 --- a/Lib/copyreg.py +++ b/Lib/copyreg.py @@ -128,7 +128,11 @@ def _slotnames(cls): continue # mangled names elif name.startswith('__') and not name.endswith('__'): - names.append('_%s%s' % (c.__name__, name)) + stripped = c.__name__.lstrip('_') + if stripped: + names.append('_%s%s' % (stripped, name)) + else: + names.append(name) else: names.append(name) |