Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
5dc9c791
Commit
5dc9c791
authored
Oct 18, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X wcfs: Kill xdefer
It has been properly implemented in pygolang:
kirr/pygolang@bb9a94c3
parent
d75b2304
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
34 deletions
+1
-34
setup.py
setup.py
+1
-1
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+0
-33
No files found.
setup.py
View file @
5dc9c791
...
...
@@ -254,7 +254,7 @@ setup(
# specify either to use e.g. ZODB3.10 or ZODB4 )
'ZODB3 >= 3.10'
,
'pygolang >= 0.0.
2
'
,
# defer, sync.WaitGroup, ...
'pygolang >= 0.0.
5
'
,
# defer, sync.WaitGroup, ...
'six'
,
# compat py2/py3
...
...
wcfs/wcfs_test.py
View file @
5dc9c791
...
...
@@ -1968,36 +1968,3 @@ def is_mountpoint(path): # -> bool
# eprint prints msg to stderr
def
eprint
(
msg
):
print
(
msg
,
file
=
sys
.
stderr
)
# xdefer is like defer, but makes sure exception raised before deferred
# function is called is not lost.
#
# if deferred function raises exception itself - it prints previous exception to stderr.
#
# XXX xdefer is workaround for Python2 not having exception chaining (PEP 3134)
# without which, if e.g. tDB.close() raises exception, it prevents to see
# whether and which an assert in the test failed.
#
# XXX merge into defer?
_defer
=
defer
# original golang.defer
def
xdefer
(
f
):
# hack - imitate as if defer called from under xdefer was called directly by caller func
fgo
=
inspect
.
currentframe
().
f_back
.
f_back
__goframe__
=
fgo
.
f_locals
[
'__goframe__'
]
_xdefer
(
f
)
def
_xdefer
(
f
):
def
_
():
# call f, but print previous exception if f raises
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
try
:
f
()
except
:
if
exc_type
is
not
None
:
traceback
.
print_exception
(
exc_type
,
exc_value
,
exc_traceback
)
raise
_defer
(
_
)
# replace defer with xdefer
defer
=
xdefer
del
xdefer
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