Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Gwenaël Samain
cython
Commits
2abf38d0
Commit
2abf38d0
authored
May 06, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass error information as arguments to __Pyx_cdivision_warning
parent
b3c46bc1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+11
-9
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+7
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
2abf38d0
...
...
@@ -6298,7 +6298,12 @@ class DivNode(NumBinopNode):
self
.
operand1
.
result
(),
self
.
operand2
.
result
()))
code
.
putln
(
code
.
set_error_info
(
self
.
pos
));
code
.
put
(
"if (__Pyx_cdivision_warning()) "
)
code
.
put
(
"if (__Pyx_cdivision_warning(%(FILENAME)s, "
"%(LINENO)s)) "
%
{
'FILENAME'
:
Naming
.
filename_cname
,
'LINENO'
:
Naming
.
lineno_cname
,
})
code
.
put_goto
(
code
.
error_label
)
code
.
putln
(
"}"
)
...
...
@@ -8633,21 +8638,18 @@ static CYTHON_INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s a, %(type)s b) {
cdivision_warning_utility_code
=
UtilityCode
(
proto
=
"""
static int __Pyx_cdivision_warning(
void
); /* proto */
static int __Pyx_cdivision_warning(
const char *, int
); /* proto */
"""
,
impl
=
"""
static int __Pyx_cdivision_warning(
void
) {
static int __Pyx_cdivision_warning(
const char *filename, int lineno
) {
return PyErr_WarnExplicit(PyExc_RuntimeWarning,
"division with oppositely signed operands, C and Python semantics differ",
%(FILENAME)s
,
%(LINENO)s
,
filename
,
lineno
,
__Pyx_MODULE_NAME,
NULL);
}
"""
%
{
'FILENAME'
:
Naming
.
filename_cname
,
'LINENO'
:
Naming
.
lineno_cname
,
})
"""
)
# from intobject.c
division_overflow_test_code
=
UtilityCode
(
...
...
Cython/Compiler/Nodes.py
View file @
2abf38d0
...
...
@@ -1343,17 +1343,20 @@ class FuncDefNode(StatNode, BlockNode):
(
self
.
return_type
.
declaration_code
(
Naming
.
retval_cname
),
init
))
tempvardecl_code
=
code
.
insertion_point
()
if
not
lenv
.
nogil
:
code
.
put_declare_refcount_context
()
self
.
generate_keyword_list
(
code
)
if
profile
:
code
.
put_trace_declarations
()
# ----- Extern library function declarations
lenv
.
generate_library_function_declarations
(
code
)
# ----- GIL acquisition
acquire_gil
=
self
.
acquire_gil
acquire_gil_for_var_decls_only
=
(
lenv
.
nogil
and
lenv
.
has_with_gil_block
)
# See if we need to acquire the GIL for variable declarations and
acquire_gil_for_var_decls_only
=
(
lenv
.
nogil
and
lenv
.
has_with_gil_block
)
use_refnanny
=
not
lenv
.
nogil
or
acquire_gil_for_var_decls_only
...
...
@@ -1362,6 +1365,7 @@ class FuncDefNode(StatNode, BlockNode):
# ----- set up refnanny
if
use_refnanny
:
tempvardecl_code
.
put_declare_refcount_context
()
code
.
put_setup_refcount_context
(
self
.
entry
.
name
)
# ----- Automatic lead-ins for certain special functions
...
...
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