Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7b01a834
Commit
7b01a834
authored
Apr 12, 2003
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use PyModule_Add{Int,String}Constant() where appropriate
(thanks to Neal Norwitz for the code review, BTW)
parent
577c7a76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
Modules/_csv.c
Modules/_csv.c
+6
-12
No files found.
Modules/_csv.c
View file @
7b01a834
...
@@ -12,6 +12,8 @@ module instead.
...
@@ -12,6 +12,8 @@ module instead.
*/
*/
#define MODULE_VERSION "1.0"
#include "Python.h"
#include "Python.h"
#include "structmember.h"
#include "structmember.h"
...
@@ -1440,9 +1442,6 @@ PyMODINIT_FUNC
...
@@ -1440,9 +1442,6 @@ PyMODINIT_FUNC
init_csv
(
void
)
init_csv
(
void
)
{
{
PyObject
*
module
;
PyObject
*
module
;
PyObject
*
rev
;
PyObject
*
v
;
int
res
;
StyleDesc
*
style
;
StyleDesc
*
style
;
if
(
PyType_Ready
(
&
Dialect_Type
)
<
0
)
if
(
PyType_Ready
(
&
Dialect_Type
)
<
0
)
...
@@ -1460,10 +1459,8 @@ init_csv(void)
...
@@ -1460,10 +1459,8 @@ init_csv(void)
return
;
return
;
/* Add version to the module. */
/* Add version to the module. */
rev
=
PyString_FromString
(
"1.0"
);
if
(
PyModule_AddStringConstant
(
module
,
"__version__"
,
if
(
rev
==
NULL
)
MODULE_VERSION
)
==
-
1
)
return
;
if
(
PyModule_AddObject
(
module
,
"__version__"
,
rev
)
<
0
)
return
;
return
;
/* Add _dialects dictionary */
/* Add _dialects dictionary */
...
@@ -1475,11 +1472,8 @@ init_csv(void)
...
@@ -1475,11 +1472,8 @@ init_csv(void)
/* Add quote styles into dictionary */
/* Add quote styles into dictionary */
for
(
style
=
quote_styles
;
style
->
name
;
style
++
)
{
for
(
style
=
quote_styles
;
style
->
name
;
style
++
)
{
v
=
PyInt_FromLong
(
style
->
style
);
if
(
PyModule_AddIntConstant
(
module
,
style
->
name
,
if
(
v
==
NULL
)
style
->
style
)
==
-
1
)
return
;
res
=
PyModule_AddObject
(
module
,
style
->
name
,
v
);
if
(
res
<
0
)
return
;
return
;
}
}
...
...
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