diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-11-07 12:23:36 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-11-07 13:24:08 +0300 |
commit | a454f5fbc2c79ea1f8e9ca584d888a57f535c8f3 (patch) | |
tree | f6f4c048c1a1388d005bcf5996285ddcaedb1ba7 /contrib/python | |
parent | a74a901e7cd8f6eeab88e728e48c22e0de2f9a0f (diff) | |
download | ydb-a454f5fbc2c79ea1f8e9ca584d888a57f535c8f3.tar.gz |
Intermediate changes
commit_hash:8dfe46ba3b02673d0e6a35fdf824ab2c98255393
Diffstat (limited to 'contrib/python')
8 files changed, 34 insertions, 29 deletions
diff --git a/contrib/python/clickhouse-connect/.dist-info/METADATA b/contrib/python/clickhouse-connect/.dist-info/METADATA index f47d5e0e6c..66c4f4ba69 100644 --- a/contrib/python/clickhouse-connect/.dist-info/METADATA +++ b/contrib/python/clickhouse-connect/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: clickhouse-connect -Version: 0.8.3 +Version: 0.8.4 Summary: ClickHouse Database Core Driver for Python, Pandas, and Superset Home-page: https://github.com/ClickHouse/clickhouse-connect Author: ClickHouse Inc. @@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 Requires-Python: ~=3.8 Description-Content-Type: text/markdown License-File: LICENSE diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py index b4ab55be61..63fa052550 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py @@ -1 +1 @@ -version = '0.8.3' +version = '0.8.4' diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py index 001c578b26..33d6b9364c 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py @@ -31,6 +31,7 @@ from clickhouse_connect.driver.transform import NativeTransform logger = logging.getLogger(__name__) columns_only_re = re.compile(r'LIMIT 0\s*$', re.IGNORECASE) +ex_header = 'X-ClickHouse-Exception-Code' # pylint: disable=too-many-instance-attributes @@ -346,7 +347,7 @@ class HttpClient(Client): params.update(self._validate_settings(settings or {})) method = 'POST' if payload or fields else 'GET' - response = self._raw_request(payload, params, headers, method, fields=fields) + response = self._raw_request(payload, params, headers, method, fields=fields, server_wait=False) if response.data: try: result = response.data.decode()[:-1].split('\t') @@ -369,10 +370,14 @@ class HttpClient(Client): finally: response.close() - err_str = f'HTTPDriver for {self.url} returned response code {response.status})' + err_str = f'HTTPDriver for {self.url} returned response code {response.status}' + err_code = response.headers.get(ex_header) + if err_code: + err_str = f'HTTPDriver for {self.url} received ClickHouse error code {err_code}' if err_content: err_msg = common.format_error(err_content.decode(errors='backslashreplace')) - err_str = f'{err_str}\n {err_msg}' + if err_msg.startswith('Code'): + err_str = f'{err_str}\n {err_msg}' else: err_str = 'The ClickHouse server returned an error.' @@ -444,7 +449,7 @@ class HttpClient(Client): finally: if query_session: self._active_session = None # Make sure we always clear this - if 200 <= response.status < 300: + if 200 <= response.status < 300 and not response.headers.get(ex_header): return response if response.status in (429, 503, 504): if attempts > retries: diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/insert.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/insert.py index 8ca1ef9f22..a54ae37c56 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/insert.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/insert.py @@ -165,8 +165,8 @@ class InsertContext(BaseQueryContext): # https://github.com/pandas-dev/pandas/issues/29024 df_col = df_col.replace({pd.NaT: None}).replace({np.nan: None}) elif 'Float' in ch_type.base_type: - # This seems to be the only way to convert any null looking things to nan - df_col = df_col.astype(ch_type.np_type) + data.append([None if pd.isnull(x) else x for x in df_col]) + continue else: df_col = df_col.replace({np.nan: None}) data.append(df_col.to_numpy(copy=False)) diff --git a/contrib/python/clickhouse-connect/ya.make b/contrib/python/clickhouse-connect/ya.make index 23919d9b30..78e990a925 100644 --- a/contrib/python/clickhouse-connect/ya.make +++ b/contrib/python/clickhouse-connect/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.8.3) +VERSION(0.8.4) LICENSE(Apache-2.0) diff --git a/contrib/python/zope.interface/py3/.dist-info/METADATA b/contrib/python/zope.interface/py3/.dist-info/METADATA index 30f01bb893..eb379d3172 100644 --- a/contrib/python/zope.interface/py3/.dist-info/METADATA +++ b/contrib/python/zope.interface/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: zope.interface -Version: 7.1.0 +Version: 7.1.1 Summary: Interfaces for Python Home-page: https://github.com/zopefoundation/zope.interface Author: Zope Foundation and Contributors @@ -76,6 +76,12 @@ For detailed documentation, please see https://zopeinterface.readthedocs.io/en/l Changes ========= +7.1.1 (2024-10-23) +================== + +- Fix segmentation faults in `weakrefobject.c` on Python 3.12 and 3.13. + (`#323 <https://github.com/zopefoundation/zope.interface/issues/323>`_) + 7.1.0 (2024-10-10) ================== diff --git a/contrib/python/zope.interface/py3/ya.make b/contrib/python/zope.interface/py3/ya.make index 2448b66894..cb1aa87e6d 100644 --- a/contrib/python/zope.interface/py3/ya.make +++ b/contrib/python/zope.interface/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(7.1.0) +VERSION(7.1.1) LICENSE(ZPL-2.1) diff --git a/contrib/python/zope.interface/py3/zope/interface/_zope_interface_coptimizations.c b/contrib/python/zope.interface/py3/zope/interface/_zope_interface_coptimizations.c index 453057a4d6..45810ec617 100644 --- a/contrib/python/zope.interface/py3/zope/interface/_zope_interface_coptimizations.c +++ b/contrib/python/zope.interface/py3/zope/interface/_zope_interface_coptimizations.c @@ -49,6 +49,11 @@ #define USE_HEAP_TYPES 1 #endif +#define BASETYPE_FLAGS \ + Py_TPFLAGS_DEFAULT | \ + Py_TPFLAGS_BASETYPE | \ + Py_TPFLAGS_HAVE_GC + #if PY_VERSION_HEX >= 0x030c0000 /* Add MANAGED_WEAKREF flag for Python >= 3.12, and don't define * the '.tp_weaklistoffset' slot. @@ -57,11 +62,7 @@ * #c.PyTypeObject.tp_weaklistoffset */ #define USE_EXPLICIT_WEAKREFLIST 0 -#define BASETYPE_FLAGS \ - Py_TPFLAGS_DEFAULT | \ - Py_TPFLAGS_BASETYPE | \ - Py_TPFLAGS_MANAGED_WEAKREF | \ - Py_TPFLAGS_HAVE_GC +#define WEAKREFTYPE_FLAGS BASETYPE_FLAGS | Py_TPFLAGS_MANAGED_WEAKREF #else /* No MANAGED_WEAKREF flag for Python < 3.12, and therefore define * the '.tp_weaklistoffset' slot, and the member whose offset it holds. @@ -70,10 +71,7 @@ * #c.PyTypeObject.tp_weaklistoffset */ #define USE_EXPLICIT_WEAKREFLIST 1 -#define BASETYPE_FLAGS \ - Py_TPFLAGS_DEFAULT | \ - Py_TPFLAGS_BASETYPE | \ - Py_TPFLAGS_HAVE_GC +#define WEAKREFTYPE_FLAGS BASETYPE_FLAGS #endif /* Static strings, used to invoke PyObject_GetAttr (only in hot paths) */ @@ -276,12 +274,8 @@ static void SB_dealloc(SB* self) { PyObject_GC_UnTrack((PyObject*)self); + PyObject_ClearWeakRefs(OBJECT(self)); PyTypeObject* tp = Py_TYPE(self); -#if USE_EXPLICIT_WEAKREFLIST - if (self->weakreflist != NULL) { - PyObject_ClearWeakRefs(OBJECT(self)); - } -#endif SB_clear(self); tp->tp_free(OBJECT(self)); #if USE_HEAP_TYPES @@ -419,7 +413,7 @@ static PyTypeObject SB_type_def = { .tp_name = SB__name__, .tp_doc = SB__doc__, .tp_basicsize = sizeof(SB), - .tp_flags = BASETYPE_FLAGS, + .tp_flags = WEAKREFTYPE_FLAGS, .tp_call = (ternaryfunc)SB__call__, .tp_traverse = (traverseproc)SB_traverse, .tp_clear = (inquiry)SB_clear, @@ -450,7 +444,7 @@ static PyType_Slot SB_type_slots[] = { static PyType_Spec SB_type_spec = { .name = SB__name__, .basicsize = sizeof(SB), - .flags = BASETYPE_FLAGS, + .flags = WEAKREFTYPE_FLAGS, .slots = SB_type_slots }; @@ -569,8 +563,7 @@ CPB_clear(CPB* self) { Py_CLEAR(self->_cls); Py_CLEAR(self->_implements); - SB_clear((SB*)self); - return 0; + return SB_clear((SB*)self); } static void |