Skip to content

uctypes incompatibility with OBJ_REPR_B #18105

@jepler

Description

@jepler

Port, board and/or hardware

unix, 32-bit, obj_repr_b

MicroPython version

based on v1.27.0-preview-154-g44986b1f04

Reproduction

  1. Make a build with OBJ_REPR_B
  2. Look at the uctypes constants

Expected behaviour

All the constants are distinct

Observed behaviour

Some of the constants are duplicates

>>> import uctypes
>>> assert uctypes.INT8 != uctypes.BFINT8
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError: 

Additional Information

See more discussion at #17688 (comment)

Patch to add a REPR_B coverage build to ci.sh:


diff --git a/tools/ci.sh b/tools/ci.sh
index 901059991e..5afe089ccb 100755
--- a/tools/ci.sh
+++ b/tools/ci.sh
@@ -543,6 +543,14 @@ CI_UNIX_OPTS_SANITIZE_UNDEFINED=(
     LDFLAGS_EXTRA="-fsanitize=undefined -fno-sanitize=nonnull-attribute"
 )
 
+CI_UNIX_OPTS_REPR_B=(
+    VARIANT=coverage
+    CFLAGS_EXTRA="-DMICROPY_OBJ_REPR=MICROPY_OBJ_REPR_B -Dmp_int_t=int32_t -Dmp_uint_t=uint32_t"
+    MICROPY_FORCE_32BIT=1
+    RUN_TESTS_MPY_CROSS_FLAGS="--mpy-cross-flags=\"-march=x86 -msmall-int-bits=30\""
+
+)
+
 function ci_unix_build_helper {
     make ${MAKEOPTS} -C mpy-cross
     make ${MAKEOPTS} -C ports/unix "$@" submodules
@@ -688,6 +696,15 @@ function ci_unix_32bit_setup {
     python3 --version
 }
 
+function ci_unix_coverage_repr_b_build {
+    ci_unix_build_helper "${CI_UNIX_OPTS_REPR_B[@]}"
+    ci_unix_build_ffi_lib_helper gcc -m32
+}
+
+function ci_unix_coverage_repr_b_run_tests {
+    ci_unix_run_tests_helper "${CI_UNIX_OPTS_REPR_B[@]}"
+}
+
 function ci_unix_coverage_32bit_build {
     ci_unix_build_helper VARIANT=coverage MICROPY_FORCE_32BIT=1
     ci_unix_build_ffi_lib_helper gcc -m32
-- 
2.47.3

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions