cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] [PATCH Python 10] bundles/pyml: Remove bindings for PyObject_As(Char|Read|Write)Buffer
@ 2020-11-10 15:10 Richard W.M. Jones
  2020-11-10 15:10 ` Richard W.M. Jones
  2020-11-10 15:15 ` Richard W.M. Jones
  0 siblings, 2 replies; 4+ messages in thread
From: Richard W.M. Jones @ 2020-11-10 15:10 UTC (permalink / raw)
  To: julia.lawall; +Cc: cocci

Some more functions were deprecated/removed in Python 10,
breaking Coccinelle compiles.  It was reported by Fedora's
Python team here:

https://bugzilla.redhat.com/show_bug.cgi?id=1896393

I have fixed it by chopping out bindings for these
functions from the bundled pyml, and it compiles fine
for me with Python 10 now.

Rich.


_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cocci] [PATCH Python 10] bundles/pyml: Remove bindings for PyObject_As(Char|Read|Write)Buffer
  2020-11-10 15:10 [Cocci] [PATCH Python 10] bundles/pyml: Remove bindings for PyObject_As(Char|Read|Write)Buffer Richard W.M. Jones
@ 2020-11-10 15:10 ` Richard W.M. Jones
  2020-11-10 15:15 ` Richard W.M. Jones
  1 sibling, 0 replies; 4+ messages in thread
From: Richard W.M. Jones @ 2020-11-10 15:10 UTC (permalink / raw)
  To: julia.lawall; +Cc: cocci

These have been removed in Python 3.10.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1896393
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
 bundles/pyml/pyml-current/py.ml        | 12 ------------
 bundles/pyml/pyml-current/py.mli       | 12 ------------
 bundles/pyml/pyml-current/pycaml.ml    |  6 ------
 bundles/pyml/pyml-current/pycaml.mli   |  3 ---
 bundles/pyml/pyml-current/pyml_stubs.c | 12 ------------
 5 files changed, 45 deletions(-)

diff --git a/bundles/pyml/pyml-current/py.ml b/bundles/pyml/pyml-current/py.ml
index fc49bc42..d33dcf77 100644
--- a/bundles/pyml/pyml-current/py.ml
+++ b/bundles/pyml/pyml-current/py.ml
@@ -36,12 +36,6 @@ external pyerr_fetch_internal: unit -> pyobject * pyobject * pyobject
     = "PyErr_Fetch_wrapper"
 external pystring_asstringandsize: pyobject -> string option
     = "PyString_AsStringAndSize_wrapper"
-external pyobject_ascharbuffer: pyobject -> string option
-    = "PyObject_AsCharBuffer_wrapper"
-external pyobject_asreadbuffer: pyobject -> string option
-    = "PyObject_AsReadBuffer_wrapper"
-external pyobject_aswritebuffer: pyobject -> string option
-    = "PyObject_AsWriteBuffer_wrapper"
 external pylong_fromstring: string -> int -> pyobject * int
     = "PyLong_FromString_wrapper"
 external pycapsule_isvalid: Pytypes.pyobject -> string -> int
@@ -1429,12 +1423,6 @@ module Object = struct
 
   let to_string item = String.to_string (str item)
 
-  let as_char_buffer obj = check_some (pyobject_ascharbuffer obj)
-
-  let as_read_buffer obj = check_some (pyobject_asreadbuffer obj)
-
-  let as_write_buffer obj = check_some (pyobject_aswritebuffer obj)
-
   external reference_count: pyobject -> int = "pyrefcount"
 
   let repr_or_string repr v =
diff --git a/bundles/pyml/pyml-current/py.mli b/bundles/pyml/pyml-current/py.mli
index 19a4599e..df509a02 100644
--- a/bundles/pyml/pyml-current/py.mli
+++ b/bundles/pyml/pyml-current/py.mli
@@ -239,18 +239,6 @@ module Object: sig
       We have
       [Py.Object.to_string o = Py.String.to_string (Py.Object.str o)]. *)
 
-  val as_char_buffer: t -> string
-  (** Wrapper for
-      {{:https://docs.python.org/3/c-api/objbuffer.html#c.PyObject_AsCharBuffer} PyObject_AsCharBuffer} *)
-
-  val as_read_buffer: t -> string
-  (** Wrapper for
-      {{:https://docs.python.org/3/c-api/objbuffer.html#c.PyObject_AsReadBuffer} PyObject_AsReadBuffer} *)
-
-  val as_write_buffer: t -> string
-  (** Wrapper for
-      {{:https://docs.python.org/3/c-api/objbuffer.html#c.PyObject_AsWriteBuffer} PyObject_AsWriteBuffer} *)
-
   val reference_count: t -> int
   (** [reference_count o] returns the number of references to the Python
       object [o]. *)
diff --git a/bundles/pyml/pyml-current/pycaml.ml b/bundles/pyml/pyml-current/pycaml.ml
index 8c93cf4a..13b16aa8 100644
--- a/bundles/pyml/pyml-current/pycaml.ml
+++ b/bundles/pyml/pyml-current/pycaml.ml
@@ -347,12 +347,6 @@ let pyunicode_asunicode = Py.String.to_unicode
 
 let pyunicode_getsize = Py.String.length
 
-let pyobject_ascharbuffer = Py.Object.as_char_buffer
-
-let pyobject_asreadbuffer = Py.Object.as_read_buffer
-
-let pyobject_aswritebuffer = Py.Object.as_write_buffer
-
 let python () =
   Py.Run.interactive ();
   0
diff --git a/bundles/pyml/pyml-current/pycaml.mli b/bundles/pyml/pyml-current/pycaml.mli
index 85b5f83c..da800bac 100644
--- a/bundles/pyml/pyml-current/pycaml.mli
+++ b/bundles/pyml/pyml-current/pycaml.mli
@@ -758,9 +758,6 @@ val pyobject_size : pyobject -> int
 val pyobject_getitem : pyobject * pyobject -> pyobject
 val pyobject_setitem : pyobject * pyobject * pyobject -> int
 val pyobject_delitem : pyobject * pyobject -> int
-val pyobject_ascharbuffer : pyobject -> string
-val pyobject_asreadbuffer : pyobject -> string
-val pyobject_aswritebuffer : pyobject -> string
 
 val pynumber_check : pyobject -> int
 val pynumber_add : pyobject * pyobject -> pyobject
diff --git a/bundles/pyml/pyml-current/pyml_stubs.c b/bundles/pyml/pyml-current/pyml_stubs.c
index 5158a0e4..cc10e821 100644
--- a/bundles/pyml/pyml-current/pyml_stubs.c
+++ b/bundles/pyml/pyml-current/pyml_stubs.c
@@ -195,12 +195,6 @@ static PyObject *Python__Py_FalseStruct;
 /* Buffer and size */
 static int (*Python_PyString_AsStringAndSize)
 (PyObject *, char **, Py_ssize_t *);
-static int (*Python_PyObject_AsCharBuffer)
-(PyObject *, const char **, Py_ssize_t *);
-static int (*Python_PyObject_AsReadBuffer)
-(PyObject *, const void **, Py_ssize_t *);
-static int (*Python_PyObject_AsWriteBuffer)
-(PyObject *, void **, Py_ssize_t *);
 
 /* Length argument */
 static PyObject *(*Python_PyLong_FromString)(const char *, const char **, int);
@@ -684,9 +678,6 @@ py_load_library(value filename_ocaml, value debug_build_ocaml)
         resolve("PyObject_CallMethodObjArgs");
     Python_PyErr_Fetch = resolve("PyErr_Fetch");
     Python_PyErr_NormalizeException = resolve("PyErr_NormalizeException");
-    Python_PyObject_AsCharBuffer = resolve("PyObject_AsCharBuffer");
-    Python_PyObject_AsReadBuffer = resolve("PyObject_AsReadBuffer");
-    Python_PyObject_AsWriteBuffer = resolve("PyObject_AsWriteBuffer");
     if (version_major >= 3) {
         Python__Py_FalseStruct = resolve("_Py_FalseStruct");
         Python_PyString_AsStringAndSize = resolve("PyBytes_AsStringAndSize");
@@ -1272,9 +1263,6 @@ pyml_wrap_ucs4_option_and_free(int32_t *buffer, bool free)
     }
 
 StringAndSize_wrapper(PyString_AsStringAndSize, char);
-StringAndSize_wrapper(PyObject_AsCharBuffer, const char);
-StringAndSize_wrapper(PyObject_AsReadBuffer, const void);
-StringAndSize_wrapper(PyObject_AsWriteBuffer, void);
 
 static FILE *
 open_file(value file, const char *mode)
-- 
2.28.0.rc2

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Cocci] [PATCH Python 10] bundles/pyml: Remove bindings for PyObject_As(Char|Read|Write)Buffer
  2020-11-10 15:10 [Cocci] [PATCH Python 10] bundles/pyml: Remove bindings for PyObject_As(Char|Read|Write)Buffer Richard W.M. Jones
  2020-11-10 15:10 ` Richard W.M. Jones
@ 2020-11-10 15:15 ` Richard W.M. Jones
  2020-11-10 17:37   ` Julia Lawall
  1 sibling, 1 reply; 4+ messages in thread
From: Richard W.M. Jones @ 2020-11-10 15:15 UTC (permalink / raw)
  To: julia.lawall; +Cc: cocci

On Tue, Nov 10, 2020 at 03:10:57PM +0000, Richard W.M. Jones wrote:
> Some more functions were deprecated/removed in Python 10,
> breaking Coccinelle compiles.  It was reported by Fedora's
> Python team here:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1896393
> 
> I have fixed it by chopping out bindings for these
> functions from the bundled pyml, and it compiles fine
> for me with Python 10 now.

Erm, Python 3.10, not Python 10 obviously :-)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Cocci] [PATCH Python 10] bundles/pyml: Remove bindings for PyObject_As(Char|Read|Write)Buffer
  2020-11-10 15:15 ` Richard W.M. Jones
@ 2020-11-10 17:37   ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2020-11-10 17:37 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: cocci



On Tue, 10 Nov 2020, Richard W.M. Jones wrote:

> On Tue, Nov 10, 2020 at 03:10:57PM +0000, Richard W.M. Jones wrote:
> > Some more functions were deprecated/removed in Python 10,
> > breaking Coccinelle compiles.  It was reported by Fedora's
> > Python team here:
> >
> > https://bugzilla.redhat.com/show_bug.cgi?id=1896393
> >
> > I have fixed it by chopping out bindings for these
> > functions from the bundled pyml, and it compiles fine
> > for me with Python 10 now.
>
> Erm, Python 3.10, not Python 10 obviously :-)

Thanks for the patch.

julia


>
> Rich.
>
> --
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> virt-df lists disk usage of guests without needing to install any
> software inside the virtual machine.  Supports Linux and Windows.
> http://people.redhat.com/~rjones/virt-df/
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-10 17:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 15:10 [Cocci] [PATCH Python 10] bundles/pyml: Remove bindings for PyObject_As(Char|Read|Write)Buffer Richard W.M. Jones
2020-11-10 15:10 ` Richard W.M. Jones
2020-11-10 15:15 ` Richard W.M. Jones
2020-11-10 17:37   ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).