Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69112dd

Browse files
authored
[mypyc] Fix compilation of byteswriter_extra_ops (#20403)
Compiling byteswriter_extra_ops.c on its own fails because it uses typesfrom Python.h without including it so add the include directive.It also references `BytesWriterObject` which is defined only when`MYPYC_EXPERIMENTAL` is defined so wrap the functions with the same`ifdef`.Also add the explicit include of Python.h in other header files thatcurrently rely on the file being included above them when compiling.Remove unused variables.
1 parentfd86abd commit69112dd

File tree

7 files changed

+18
-2
lines changed

7 files changed

+18
-2
lines changed

‎mypyc/lib-rt/byteswriter_extra_ops.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include"byteswriter_extra_ops.h"
55

6+
#ifdefMYPYC_EXPERIMENTAL
7+
68
charCPyBytesWriter_Write(PyObject*obj,PyObject*value) {
79
BytesWriterObject*self= (BytesWriterObject*)obj;
810
constchar*data;
@@ -29,3 +31,5 @@ char CPyBytesWriter_Write(PyObject *obj, PyObject *value) {
2931
self->len+=size;
3032
returnCPY_NONE;
3133
}
34+
35+
#endif// MYPYC_EXPERIMENTAL

‎mypyc/lib-rt/byteswriter_extra_ops.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#ifndefBYTESWRITER_EXTRA_OPS_H
22
#defineBYTESWRITER_EXTRA_OPS_H
33

4+
#ifdefMYPYC_EXPERIMENTAL
5+
6+
#include<stdint.h>
7+
#include<Python.h>
8+
49
#include"librt_strings.h"
510

611
staticinlineCPyTagged
@@ -31,4 +36,6 @@ CPyBytesWriter_Append(PyObject *obj, uint8_t value) {
3136

3237
charCPyBytesWriter_Write(PyObject*obj,PyObject*value);
3338

39+
#endif// MYPYC_EXPERIMENTAL
40+
3441
#endif

‎mypyc/lib-rt/function_wrapper.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ static PyObject* CPyFunction_repr(CPyFunction *op) {
3333
}
3434

3535
staticPyObject*CPyFunction_call(PyObject*func,PyObject*args,PyObject*kw) {
36-
PyObject*result;
3736
CPyFunction*f= (CPyFunction*)func;
3837
vectorcallfuncvc=CPyFunction_func_vectorcall(f);
3938
assert(vc);

‎mypyc/lib-rt/getargs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ static void
437437
skipitem(constchar**p_format,va_list*p_va)
438438
{
439439
constchar*format=*p_format;
440-
charc=*format++;
440+
format++;
441441

442442
if (p_va!=NULL) {
443443
(void)va_arg(*p_va,PyObject**);

‎mypyc/lib-rt/librt_base64.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import_librt_base64(void)
1212

1313
#else// MYPYC_EXPERIMENTAL
1414

15+
#include<Python.h>
16+
1517
#defineLIBRT_BASE64_ABI_VERSION 1
1618
#defineLIBRT_BASE64_API_VERSION 2
1719
#defineLIBRT_BASE64_API_LEN 4

‎mypyc/lib-rt/librt_internal.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndefLIBRT_INTERNAL_H
22
#defineLIBRT_INTERNAL_H
33

4+
#include<Python.h>
5+
46
// ABI version -- only an exact match is compatible. This will only be changed in
57
// very exceptional cases (likely never) due to strict backward compatibility
68
// requirements.

‎mypyc/lib-rt/librt_strings.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import_librt_strings(void)
1212

1313
#else// MYPYC_EXPERIMENTAL
1414

15+
#include<Python.h>
16+
1517
// ABI version -- only an exact match is compatible. This will only be changed in
1618
// very exceptional cases (likely never) due to strict backward compatibility
1719
// requirements.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp