parent
37795530c7
commit
7f27612849
@ -1 +1 @@
|
|||||||
/liborcus-0.16.1.tar.xz
|
/liborcus-0.17.2.tar.xz
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
From 34f93cdc383432aeb34c31184de8a2fb5940e0c7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: David Tardon <dtardon@redhat.com>
|
|
||||||
Date: Sun, 2 May 2021 20:46:42 +0200
|
|
||||||
Subject: [PATCH] make FormatType conversion work with python 3.10
|
|
||||||
|
|
||||||
The str() function for Enum returns only the member name since 3.10:
|
|
||||||
https://docs.python.org/3.10/whatsnew/3.10.html#enum
|
|
||||||
Let's just check separately the enum type name and the member name.
|
|
||||||
---
|
|
||||||
src/python/sheet.cpp | 18 +++++++++---------
|
|
||||||
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/python/sheet.cpp b/src/python/sheet.cpp
|
|
||||||
index 85067868..cf6d8b2c 100644
|
|
||||||
--- a/src/python/sheet.cpp
|
|
||||||
+++ b/src/python/sheet.cpp
|
|
||||||
@@ -113,29 +113,29 @@ format_t to_format_type_enum(PyObject* format)
|
|
||||||
static const char* err_not_format_type = "An enum value of 'orcus.FormatType' was expected.";
|
|
||||||
static const char* err_format_not_supported = "Unsupported format type.";
|
|
||||||
|
|
||||||
- PyObject* format_s = PyObject_Str(format); // new reference
|
|
||||||
- if (!format_s)
|
|
||||||
+ // Check the type name.
|
|
||||||
+
|
|
||||||
+ PyTypeObject* type = Py_TYPE(format);
|
|
||||||
+ if (!type || strncmp(type->tp_name, "FormatType", 10u) != 0)
|
|
||||||
{
|
|
||||||
PyErr_SetString(PyExc_RuntimeError, err_not_format_type);
|
|
||||||
return format_t::unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
- const char* p = PyUnicode_AsUTF8(format_s);
|
|
||||||
+ // Now check the member name.
|
|
||||||
|
|
||||||
- // Make sure that the string starts with 'FormatType.'.
|
|
||||||
- if (!p || strnlen(p, 11u) < 11u || strncmp(p, "FormatType.", 11u))
|
|
||||||
+ PyObject* format_s = PyObject_GetAttrString(format, "name"); // new reference
|
|
||||||
+ if (!format_s)
|
|
||||||
{
|
|
||||||
PyErr_SetString(PyExc_RuntimeError, err_not_format_type);
|
|
||||||
- Py_DECREF(format_s);
|
|
||||||
return format_t::unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
- p += 11; // Move it to the char past the '.'.
|
|
||||||
-
|
|
||||||
// TODO : currently we only support csv format. Change this code when we
|
|
||||||
// add more format type(s) to support.
|
|
||||||
|
|
||||||
- if (strncmp(p, "CSV", 3u))
|
|
||||||
+ const char* p = PyUnicode_AsUTF8(format_s);
|
|
||||||
+ if (!p || strncmp(p, "CSV", 3u) != 0)
|
|
||||||
{
|
|
||||||
PyErr_SetString(PyExc_RuntimeError, err_format_not_supported);
|
|
||||||
Py_DECREF(format_s);
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
diff --git a/src/liborcus/orcus_xlsx.cpp b/src/liborcus/orcus_xlsx.cpp
|
|
||||||
index d9e16ef..604b0f8 100644
|
|
||||||
--- a/src/liborcus/orcus_xlsx.cpp
|
|
||||||
+++ b/src/liborcus/orcus_xlsx.cpp
|
|
||||||
@@ -30,6 +30,7 @@
|
|
||||||
#include "ooxml_global.hpp"
|
|
||||||
#include "spreadsheet_iface_util.hpp"
|
|
||||||
|
|
||||||
+#include <limits>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
diff --git a/src/liborcus/xls_xml_context.cpp b/src/liborcus/xls_xml_context.cpp
|
|
||||||
index 3ca72e5..7504b4c 100644
|
|
||||||
--- a/src/liborcus/xls_xml_context.cpp
|
|
||||||
+++ b/src/liborcus/xls_xml_context.cpp
|
|
||||||
@@ -16,6 +16,7 @@
|
|
||||||
#include <mdds/sorted_string_map.hpp>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
+#include <limits>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
namespace ss = orcus::spreadsheet;
|
|
||||||
diff --git a/src/liborcus/xlsx_revision_context.cpp b/src/liborcus/xlsx_revision_context.cpp
|
|
||||||
index edfd9ee..0b6ec0a 100644
|
|
||||||
--- a/src/liborcus/xlsx_revision_context.cpp
|
|
||||||
+++ b/src/liborcus/xlsx_revision_context.cpp
|
|
||||||
@@ -16,6 +16,7 @@
|
|
||||||
#include "orcus/global.hpp"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
+#include <limits>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
@ -1 +1 @@
|
|||||||
SHA512 (liborcus-0.16.1.tar.xz) = 6d75591820af65181dd3a418f051a359695083f29c7d9c77edbcab3e89d9ea367824be0b19f27a31267525f446936145f5780a0ce3c6ee2d89823742837d4739
|
SHA512 (liborcus-0.17.2.tar.xz) = 8ad8db46c23673260057aff555286d95ebfeff0a027bdeae24f11f8aa12456284f7f4446edddb91936b3011eb1227cfe1618ab3c4d909f8356c8c151f5739d79
|
||||||
|
Loading…
Reference in new issue