From e60d95acd78be0b940a23169c937b53864636c34 Mon Sep 17 00:00:00 2001 From: FullteaR Date: Sun, 29 Oct 2023 16:11:48 +0900 Subject: [PATCH] add \n --- Modules/_io/bytesio.c | 4 ++-- Modules/mmapmodule.c | 13 ++++++++++--- Objects/memoryobject.c | 8 ++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c index d5939020829b72..3ab2b85852efee 100644 --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -1095,7 +1095,7 @@ bytesiobuf_getbuffer(bytesiobuf *obj, Py_buffer *view, int flags) PyBytes_AS_STRING(b->buf), b->string_size, 0, flags); b->exports++; - printf("b->exports++ in bytesiobuf_getbuffer(bytesio.c) called"); + printf("b->exports++ in bytesiobuf_getbuffer(bytesio.c) called\n"); return 0; } @@ -1104,7 +1104,7 @@ bytesiobuf_releasebuffer(bytesiobuf *obj, Py_buffer *view) { bytesio *b = (bytesio *) obj->source; b->exports--; - printf("b->exports-- in bytesiobuf_releasebuffer(bytesio.c) called"); + printf("b->exports-- in bytesiobuf_releasebuffer(bytesio.c) called\n"); } static int diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 44d5acf709425e..3aeacfd97e0557 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -24,11 +24,18 @@ #define PY_SSIZE_T_CLEAN #include -#include #include "pycore_bytesobject.h" // _PyBytes_Find() #include "pycore_fileutils.h" // _Py_stat_struct #include "structmember.h" // PyMemberDef #include // offsetof() +#ifndef MS_WINDOWS +# include // close() +#endif +#include + +// to support MS_WINDOWS_SYSTEM OpenFileMappingA / CreateFileMappingA +// need to be replaced with OpenFileMappingW / CreateFileMappingW +#if !defined(MS_WINDOWS) || defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_GAMES) #ifndef MS_WINDOWS #define UNIX @@ -941,7 +948,7 @@ mmap_buffer_getbuf(mmap_object *self, Py_buffer *view, int flags) (self->access == ACCESS_READ), flags) < 0) return -1; self->exports++; - printf("self->exports++ in mmap_buffer_getbuf(mmapmodule.c) called"); + printf("self->exports++ in mmap_buffer_getbuf(mmapmodule.c) called\n"); return 0; } @@ -949,7 +956,7 @@ static void mmap_buffer_releasebuf(mmap_object *self, Py_buffer *view) { self->exports--; - printf("self->exports-- in mmap_buffer_releasebuf(mmapmodule.c) called"); + printf("self->exports-- in mmap_buffer_releasebuf(mmapmodule.c) called\n"); } static Py_ssize_t diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index e60a236895f867..1089876e3d38e1 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -686,7 +686,7 @@ mbuf_add_view(_PyManagedBufferObject *mbuf, const Py_buffer *src) mv->mbuf = mbuf; Py_INCREF(mbuf); mbuf->exports++; - printf("mbuf->exports++ in mbuf_add_view(memoryobject.c) called"); + printf("mbuf->exports++ in mbuf_add_view(memoryobject.c) called\n"); return (PyObject *)mv; } @@ -718,7 +718,7 @@ mbuf_add_incomplete_view(_PyManagedBufferObject *mbuf, const Py_buffer *src, mv->mbuf = mbuf; Py_INCREF(mbuf); mbuf->exports++; - printf("mbuf->exports++ in mbuf_add_incomplete_view(memoryobject.c) called"); + printf("mbuf->exports++ in mbuf_add_incomplete_view(memoryobject.c) called\n"); return (PyObject *)mv; } @@ -1519,7 +1519,7 @@ memory_getbuf(PyMemoryViewObject *self, Py_buffer *view, int flags) view->obj = (PyObject *)self; Py_INCREF(view->obj); self->exports++; - printf("self->exports++ in memory_getbuf(memoryobject.c) called"); + printf("self->exports++ in memory_getbuf(memoryobject.c) called\n"); return 0; } @@ -1527,7 +1527,7 @@ static void memory_releasebuf(PyMemoryViewObject *self, Py_buffer *view) { self->exports--; - printf("self->exports-- in memory_releasebuf(memoryobject.c) called"); + printf( "self->exports-- in memory_releasebuf(memoryobject.c) called\n"); return; /* PyBuffer_Release() decrements view->obj after this function returns. */ }