Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
erp5
Commits
9b74110a
Commit
9b74110a
authored
Aug 31, 2020
by
Bryton Lacquement
🚪
Committed by
Arnaud Fontaine
Feb 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: PythonScript broken state
parent
199bbc3b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
product/ERP5Type/patches/my2to3_patch.py
product/ERP5Type/patches/my2to3_patch.py
+6
-1
No files found.
product/ERP5Type/patches/my2to3_patch.py
View file @
9b74110a
...
...
@@ -2,6 +2,7 @@ import inspect, new, os
from
compiler
import
future
,
pyassem
,
walk
from
Acquisition
import
aq_parent
from
ZODB.broken
import
BrokenModified
from
my2to3.trace
import
apply_fixers
,
patch_imports
,
tracing_functions
from
Products.PageTemplates.ZRPythonExpr
import
PythonExpr
from
Products.PythonScripts.PythonScript
import
_marker
,
PythonScript
,
PythonScriptTracebackSupplement
...
...
@@ -39,12 +40,17 @@ if my2to3_action == "trace":
# We need the file path (i.e. self.get_filepath()). This information
# is contained in state['_filepath'], but it is not always the case.
# Calling ___setstate__ before makes this information available.
# XXX: above comment not up-to-date
new_body
=
apply_fixers
(
state
[
'_body'
],
self
.
get_filepath
())
if
new_body
!=
state
[
'_body'
]:
state
[
'_body'
]
=
new_body
# This time, it's called to update the body.
self
.
___setstate__
(
state
)
self
.
_compile
()
self
.
_p_changed
=
False
def
__reduce__
(
self
,
*
args
):
raise
BrokenModified
(
self
)
# Add new "builtins" which the script can access
def
_exec
(
self
,
bound_names
,
args
,
kw
):
...
...
@@ -164,7 +170,6 @@ elif my2to3_action == "whatever":
else
:
if
caller
[
1
]
==
__file__
and
caller
[
2
]
==
126
:
# Patch, to add "future" features
# See https://github.com/python/cpython/blob/8d21aa21f2cbc6d50aab3f420bb23be1d081dac4/Lib/compiler/pycodegen.py#L214
futures
=
self
.
get_module
().
futures
assert
futures
==
(),
futures
self
.
get_module
().
futures
=
(
"division"
,)
# TODO: ...
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment