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
Xavier Thompson
cython
Commits
37fb8a2d
Commit
37fb8a2d
authored
Sep 25, 2018
by
mattip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MAINT: cannot use local enum in __Pyx functions
parent
b27baf04
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
19 deletions
+26
-19
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+5
-5
Cython/Utility/ImportExport.c
Cython/Utility/ImportExport.c
+11
-11
runtests.py
runtests.py
+10
-3
No files found.
Cython/Compiler/ModuleNode.py
View file @
37fb8a2d
...
...
@@ -3061,17 +3061,17 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# check_size
if
not
type
.
is_external
or
type
.
is_subclassed
:
cs
=
'__PYX_CHECKSIZE_STRICT'
cs
=
0
elif
type
.
check_size
==
b'min'
:
cs
=
'__PYX_CHECKSIZE_MIN'
cs
=
1
elif
type
.
check_size
is
True
:
cs
=
'__PYX_CHECKSIZE_STRICT'
cs
=
0
elif
type
.
check_size
is
False
:
cs
=
'__PYX_CHECKSIZE_LOOSE'
cs
=
2
else
:
raise
AttributeError
(
"invalid value for check_size '%r' when compiling "
"%s.%s"
%
(
type
.
check_size
,
module_name
,
type
.
name
))
code
.
putln
(
'%
s
);'
%
cs
)
code
.
putln
(
'%
d
);'
%
cs
)
code
.
putln
(
' if (!%s) %s'
%
(
type
.
typeptr_cname
,
error_code
))
...
...
Cython/Utility/ImportExport.c
View file @
37fb8a2d
...
...
@@ -308,22 +308,22 @@ set_path:
/////////////// TypeImport.proto ///////////////
typedef
enum
{
/* What to do if tp_basicsize is different from size? */
__PYX_CHECKSIZE_STRICT
,
/* Error */
__PYX_CHECKSIZE_MIN
,
/* Error if tp_basicsize is smaller, warn if larger */
__PYX_CHECKSIZE_LOOSE
,
/* Error if tp_basicsize is smaller */
}
__pyx_CheckSizeState
;
static
PyTypeObject
*
__Pyx_ImportType
(
PyObject
*
module
,
const
char
*
module_name
,
const
char
*
class_name
,
size_t
size
,
__pyx_CheckSizeState
check_size
);
/*proto*/
static
PyTypeObject
*
__Pyx_ImportType
(
PyObject
*
module
,
const
char
*
module_name
,
const
char
*
class_name
,
size_t
size
,
int
check_size
);
/*proto*/
/////////////// TypeImport ///////////////
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static
PyTypeObject
*
__Pyx_ImportType
(
PyObject
*
module
,
const
char
*
module_name
,
const
char
*
class_name
,
size_t
size
,
__pyx_CheckSizeState
check_size
)
size_t
size
,
int
check_size
)
{
/*
* check_size tells what to do if tp_basicsize is different from size:
* 0 - Error (originates in check_size=True)
* 1 - Error if tp_basicsize is smaller, warn if larger (originates in check_size='min')
* 2 - Error if tp_basicsize is smaller (originates in check_size=False)
*/
PyObject
*
result
=
0
;
char
warning
[
200
];
Py_ssize_t
basicsize
;
...
...
@@ -359,21 +359,21 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name,
module_name
,
class_name
,
size
,
basicsize
);
goto
bad
;
}
if
(
check_size
==
__PYX_CHECKSIZE_STRICT
&&
(
size_t
)
basicsize
!=
size
)
{
if
(
check_size
==
0
&&
(
size_t
)
basicsize
!=
size
)
{
PyErr_Format
(
PyExc_ValueError
,
"%.200s.%.200s size changed, may indicate binary incompatibility. "
"Expected %zd from C header, got %zd from PyObject"
,
module_name
,
class_name
,
size
,
basicsize
);
goto
bad
;
}
else
if
(
check_size
==
__PYX_CHECKSIZE_MIN
&&
(
size_t
)
basicsize
>
size
)
{
else
if
(
check_size
==
1
&&
(
size_t
)
basicsize
>
size
)
{
PyOS_snprintf
(
warning
,
sizeof
(
warning
),
"%s.%s size changed, may indicate binary incompatibility. "
"Expected %zd from C header, got %zd from PyObject"
,
module_name
,
class_name
,
size
,
basicsize
);
if
(
PyErr_WarnEx
(
NULL
,
warning
,
0
)
<
0
)
goto
bad
;
}
/*
__PYX_CHECKSIZE_LOOSE
does not warn nor error */
/*
check_size == 2
does not warn nor error */
return
(
PyTypeObject
*
)
result
;
bad:
Py_XDECREF
(
result
);
...
...
runtests.py
View file @
37fb8a2d
...
...
@@ -1735,6 +1735,9 @@ class EndToEndTest(unittest.TestCase):
old_path = os.environ.get('PYTHONPATH')
env = dict(os.environ)
env['PYTHONPATH'] = self.cython_syspath + os.pathsep + (old_path or '')
cmd = []
out = []
err = []
for command_no, command in enumerate(filter(None, commands.splitlines()), 1):
with self.stats.time('%s(%d)' % (self.name, command_no), 'c',
'etoe-build' if ' setup.py ' in command else 'etoe-run'):
...
...
@@ -1743,11 +1746,15 @@ class EndToEndTest(unittest.TestCase):
stdout=subprocess.PIPE,
shell=True,
env=env)
out, err = p.communicate()
_out, _err = p.communicate()
cmd.append(command)
out.append(_out)
err.append(_err)
res = p.returncode
if res != 0:
sys.stderr.write("%s
\
n
%s
\
n
%s
\
n
" % (
command, self._try_decode(out), self._try_decode(err)))
for c, o, e in zip(cmd, out, err):
sys.stderr.write("%s
\
n
%s
\
n
%s
\
n
\
n
" % (
c, self._try_decode(o), self._try_decode(e)))
self.assertEqual(0, res, "non-zero exit status")
self.success = True
...
...
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