Mercurial > cpython-lru_cache-weakref
annotate Lib/lib2to3/fixes/fix_buffer.py @ 80661:94de77bd0b4b 2.7
Issue #16194: document imp.load_dynamic problems
when read several extension modules from the same binary object file.
| author | Andrew Svetlov <andrew.svetlov@gmail.com> |
|---|---|
| date | Thu, 29 Nov 2012 19:51:28 +0200 |
| parents | b36cb4602e21 |
| children |
| rev | line source |
|---|---|
|
58737
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
1 # Copyright 2007 Google, Inc. All Rights Reserved. |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
2 # Licensed to PSF under a Contributor Agreement. |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
3 |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
4 """Fixer that changes buffer(...) into memoryview(...).""" |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
5 |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
6 # Local imports |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
7 from .. import fixer_base |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
8 from ..fixer_util import Name |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
9 |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
10 |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
11 class FixBuffer(fixer_base.BaseFix): |
|
65340
7d1e453b120b
Merged revisions 83852-83853,83857,84042,84216,84274-84276,84375,85388,85478,85506-85508 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
54696
diff
changeset
|
12 BM_compatible = True |
|
58737
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
13 |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
14 explicit = True # The user must ask for this fixer |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
15 |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
16 PATTERN = """ |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
17 power< name='buffer' trailer< '(' [any] ')' > any* > |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
18 """ |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
19 |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
20 def transform(self, node, results): |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
21 name = results["name"] |
|
fab380674959
copy lib2to3 from the trunk
Benjamin Peterson <benjamin@python.org>
parents:
diff
changeset
|
22 name.replace(Name(u"memoryview", prefix=name.prefix)) |
