~ubuntu-branches/ubuntu/saucy/pyicu/saucy

« back to all changes in this revision

Viewing changes to debian/patches/ICUtzinfo-not-heap-type.dpatch

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-05-15 15:38:16 UTC
  • Revision ID: package-import@ubuntu.com-20120515153816-fzp4jn0h3kk9c9id
Tags: 1.3-1ubuntu1
* Add Python 3 packages (see Debian #671361; uploading in advance of
  Debian in order to be able to complete a port of ubiquity).
* Replace ICUtzinfo-not-heap-type.dpatch with upstream r191, which
  restores Python 3 compatibility.
* Drop manual cleaning of python-pyicu-dbg, since dh_python2 handles this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
2
## ICUtzinfo-not-heap-type.dpatch by Jakub Wilk <jwilk@debian.org>
3
3
##
4
 
## DP: Revert upstream change to make ICUtzinfo a heap type.
 
4
## DP: Fix bug with default tzinfo set on ICUtzinfo type.
5
5
## DP: See https://bugzilla.osafoundation.org/show_bug.cgi?id=13038
6
6
 
 
7
diff --git a/common.cpp b/common.cpp
 
8
index e9d704f..84099eb 100644
 
9
--- a/common.cpp
 
10
+++ b/common.cpp
 
11
@@ -33,6 +33,7 @@
 
12
 
 
13
 static PyObject *utcoffset_NAME;
 
14
 static PyObject *toordinal_NAME;
 
15
+static PyObject *getDefault_NAME;
 
16
 
 
17
 
 
18
 typedef struct {
 
19
@@ -355,7 +356,7 @@ EXPORT UDate PyObject_AsUDate(PyObject *object)
 
20
                 PyObject *m = PyImport_ImportModule("icu");
 
21
                 PyObject *cls = PyObject_GetAttrString(m, "ICUtzinfo");
 
22
 
 
23
-                tzinfo = PyObject_GetAttrString(cls, "default");
 
24
+                tzinfo = PyObject_CallMethodObjArgs(cls, getDefault_NAME, NULL);
 
25
                 Py_DECREF(cls);
 
26
                 Py_DECREF(m);
 
27
 
 
28
@@ -1241,4 +1242,5 @@ void _init_common(PyObject *m)
 
29
 
 
30
     utcoffset_NAME = PyString_FromString("utcoffset");
 
31
     toordinal_NAME = PyString_FromString("toordinal");
 
32
+    getDefault_NAME = PyString_FromString("getDefault");
 
33
 }
 
34
diff --git a/setup.py b/setup.py
 
35
index 86d0253..329ce57 100644
 
36
--- a/setup.py
 
37
+++ b/setup.py
 
38
@@ -25,6 +25,15 @@ CFLAGS = {
 
39
     'sunos5': ['-DPYICU_VER="%s"' %(VERSION)],
 
40
 }
 
41
 
 
42
+# added to CFLAGS when setup is invoked with --debug
 
43
+DEBUG_CFLAGS = {
 
44
+    'darwin': ['-O0', '-g', '-DDEBUG'],
 
45
+    'linux': ['-O0', '-g', '-DDEBUG'],
 
46
+    'freebsd7': ['-O0', '-g', '-DDEBUG'],
 
47
+    'win32': ['/Od', '/DDEBUG'],
 
48
+    'sunos5': ['-DDEBUG'],
 
49
+}
 
50
+
 
51
 LFLAGS = {
 
52
     'darwin': ['-L/usr/local/lib'],
 
53
     'linux': [],
 
54
@@ -55,6 +64,12 @@ if 'PYICU_CFLAGS' in os.environ:
 
55
 else:
 
56
     _cflags = CFLAGS[platform]
 
57
 
 
58
+if '--debug' in sys.argv:
 
59
+    if 'PYICU_DEBUG_CFLAGS' in os.environ:
 
60
+        _cflags += os.environ['PYICU_DEBUG_CFLAGS'].split(os.pathsep)
 
61
+    else:
 
62
+        _cflags += DEBUG_CFLAGS[platform]
 
63
+
 
64
 if 'PYICU_LFLAGS' in os.environ:
 
65
     _lflags = os.environ['PYICU_LFLAGS'].split(os.pathsep)
 
66
 else:
7
67
diff --git a/tzinfo.cpp b/tzinfo.cpp
 
68
index 2113b82..046faf1 100644
8
69
--- a/tzinfo.cpp
9
70
+++ b/tzinfo.cpp
10
 
@@ -122,7 +122,6 @@
 
71
@@ -122,7 +122,6 @@ PyTypeObject TZInfoType = {
11
72
     0,                                  /* tp_setattro */
12
73
     0,                                  /* tp_as_buffer */
13
74
     (Py_TPFLAGS_DEFAULT |
15
76
      Py_TPFLAGS_BASETYPE),              /* tp_flags */
16
77
     "",                                 /* tp_doc */
17
78
     0,                                  /* tp_traverse */
18
 
@@ -445,7 +444,7 @@
 
79
@@ -445,7 +444,6 @@ static PyObject *t_tzinfo__resetDefault(PyTypeObject *cls)
19
80
 
20
81
             Py_XDECREF((PyObject *) _default);
21
82
             _default = (t_tzinfo *) tzinfo;
22
83
-            PyObject_SetAttrString((PyObject *)&TZInfoType, "default", tzinfo);
23
 
+            PyDict_SetItemString(TZInfoType.tp_dict, "default", tzinfo);
24
84
 
25
85
             Py_RETURN_NONE;
26
86
         }
27
 
 
 
87
@@ -488,7 +486,6 @@ static PyObject *t_tzinfo_setDefault(PyTypeObject *cls, PyObject *arg)
 
88
 
 
89
     Py_INCREF(arg);
 
90
     _default = (t_tzinfo *) arg;
 
91
-    PyDict_SetItemString(TZInfoType.tp_dict, "default", arg);
 
92
 
 
93
     if (prev)
 
94
         return prev;
 
95
@@ -719,10 +716,7 @@ void _init_tzinfo(PyObject *m)
 
96
                 PyObject_Call((PyObject *) &FloatingTZType, args, NULL);
 
97
 
 
98
             if (floating && PyObject_TypeCheck(floating, &FloatingTZType))
 
99
-            {
 
100
                 _floating = (t_tzinfo *) floating;
 
101
-                PyDict_SetItemString(TZInfoType.tp_dict, "floating", floating);
 
102
-            }
 
103
             else
 
104
                 Py_XDECREF(floating);
 
105
             Py_DECREF(args);
 
106
diff --git a/tzinfo.h b/tzinfo.h
 
107
index e129465..182459f 100644
 
108
--- a/tzinfo.h
 
109
+++ b/tzinfo.h
 
110
@@ -24,8 +24,6 @@
 
111
 #ifndef _tzinfo_h
 
112
 #define _tzinfo_h
 
113
 
 
114
-extern PyTypeObject TZInfoType;
 
115
-
 
116
 void _init_tzinfo(PyObject *m);
 
117
 
 
118
 #endif /* _tzinfo_h */