Skip to content

Commit 6c2e3ab

Browse files
committed
* Add HIDDEN attribute to datetime related global variables.
* Make const strings static, which essentially makes them labels for the strings.
1 parent fe853d0 commit 6c2e3ab

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

psycopg/adapter_datetime.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838

3939
/* the pointer to the datetime module API is initialized by the module init
4040
code, we just need to grab it */
41-
extern PyObject* pyDateTimeModuleP;
42-
extern PyObject *pyDateTypeP;
43-
extern PyObject *pyTimeTypeP;
44-
extern PyObject *pyDateTimeTypeP;
45-
extern PyObject *pyDeltaTypeP;
46-
47-
extern PyObject *pyPsycopgTzModule;
48-
extern PyObject *pyPsycopgTzLOCAL;
41+
extern HIDDEN PyObject* pyDateTimeModuleP;
42+
extern HIDDEN PyObject *pyDateTypeP;
43+
extern HIDDEN PyObject *pyTimeTypeP;
44+
extern HIDDEN PyObject *pyDateTimeTypeP;
45+
extern HIDDEN PyObject *pyDeltaTypeP;
46+
47+
extern HIDDEN PyObject *pyPsycopgTzModule;
48+
extern HIDDEN PyObject *pyPsycopgTzLOCAL;
4949

5050
/* datetime_str, datetime_getquoted - return result of quoting */
5151

psycopg/adapter_mxdatetime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
/* the pointer to the mxDateTime API is initialized by the module init code,
3737
we just need to grab it */
38-
extern mxDateTimeModule_APIObject *mxDateTimeP;
38+
extern HIDDEN mxDateTimeModule_APIObject *mxDateTimeP;
3939

4040

4141
/* mxdatetime_str, mxdatetime_getquoted - return result of quoting */

psycopg/connection_int.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ conn_connect(connectionObject *self)
6767

6868
/* we need the initial date style to be ISO, for typecasters; if the user
6969
later change it, she must know what she's doing... */
70-
const char datestyle[] = "SET DATESTYLE TO 'ISO'";
71-
const char encoding[] = "SHOW client_encoding";
72-
const char isolevel[] = "SHOW default_transaction_isolation";
73-
74-
const char lvl1a[] = "read uncommitted";
75-
const char lvl1b[] = "read committed";
76-
const char lvl2a[] = "repeatable read";
77-
const char lvl2b[] = "serializable";
70+
static const char datestyle[] = "SET DATESTYLE TO 'ISO'";
71+
static const char encoding[] = "SHOW client_encoding";
72+
static const char isolevel[] = "SHOW default_transaction_isolation";
73+
74+
static const char lvl1a[] = "read uncommitted";
75+
static const char lvl1b[] = "read committed";
76+
static const char lvl2a[] = "repeatable read";
77+
static const char lvl2b[] = "serializable";
7878

7979
Py_BEGIN_ALLOW_THREADS;
8080
pgconn = PQconnectdb(self->dsn);

psycopg/typecast_datetime.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626
/* the pointer to the datetime module API is initialized by the module init
2727
code, we just need to grab it */
28-
extern PyObject* pyDateTimeModuleP;
29-
extern PyObject *pyDateTypeP;
30-
extern PyObject *pyTimeTypeP;
31-
extern PyObject *pyDateTimeTypeP;
32-
extern PyObject *pyDeltaTypeP;
28+
extern HIDDEN PyObject* pyDateTimeModuleP;
29+
extern HIDDEN PyObject *pyDateTypeP;
30+
extern HIDDEN PyObject *pyTimeTypeP;
31+
extern HIDDEN PyObject *pyDateTimeTypeP;
32+
extern HIDDEN PyObject *pyDeltaTypeP;
3333

3434
/** DATE - cast a date into a date python object **/
3535

psycopg/typecast_mxdatetime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/* the pointer to the mxDateTime API is initialized by the module init code,
2525
we just need to grab it */
26-
extern mxDateTimeModule_APIObject *mxDateTimeP;
26+
extern HIDDEN mxDateTimeModule_APIObject *mxDateTimeP;
2727

2828
/** DATE - cast a date into mx.DateTime python object **/
2929

0 commit comments

Comments
 (0)