Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-94808: add tests covering PySequence_{Set,Del}Slice #99123

Merged
merged 5 commits into from
Nov 5, 2022

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Nov 5, 2022

These two method were not covered:
Снимок экрана 2022-11-05 в 15 12 39
Снимок экрана 2022-11-05 в 15 12 29

I haven't covered null_error(); case, because it is impossible to reach from python code.
And it is also quite trivial not to bother writing its own C-level tests.

@iritkatriel iritkatriel self-assigned this Nov 5, 2022
# Immutable sequences must raise:
((1, 2, 3, 4), 1, 3, (8, 9)),
('abcd', 1, 3, 'xy'),
# Not a sequnce:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: sequnce

Lib/test/test_capi.py Outdated Show resolved Hide resolved
@iritkatriel iritkatriel removed the needs backport to 3.10 only security fixes label Nov 5, 2022
@iritkatriel iritkatriel changed the title gh-94808: cover PySequence_{Set,Del}Slice gh-94808: add tests covering PySequence_{Set,Del}Slice Nov 5, 2022
@iritkatriel iritkatriel merged commit c5c4077 into python:main Nov 5, 2022
@miss-islington
Copy link
Contributor

Thanks @sobolevn for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 5, 2022
…nGH-99123)

(cherry picked from commit c5c4077)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@bedevere-bot
Copy link

GH-99133 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Nov 5, 2022
miss-islington added a commit that referenced this pull request Nov 5, 2022
(cherry picked from commit c5c4077)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot wasm32-wasi 3.x has failed when building commit c5c4077.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1046/builds/808) and take a look at the build logs.
  4. Check if the failure is related to this commit (c5c4077) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/1046/builds/808

Failed tests:

  • test_ctypes

Summary of the results of the build (if available):

== Tests result: FAILURE ==

327 tests OK.

10 slowest tests:

  • test_tokenize: 1 min 19 sec
  • test_unparse: 46.7 sec
  • test_lib2to3: 29.4 sec
  • test_capi: 22.2 sec
  • test_unicodedata: 21.3 sec
  • test_pickle: 13.0 sec
  • test_decimal: 12.6 sec
  • test_buffer: 11.4 sec
  • test_statistics: 10.4 sec
  • test_zipfile: 8.7 sec

1 test failed:
test_ctypes

108 tests skipped:
test__xxsubinterpreters test_asyncgen test_asynchat test_asyncio
test_asyncore test_bz2 test_check_c_globals test_clinic
test_cmd_line test_concurrent_futures test_contextlib_async
test_curses test_dbm_gnu test_dbm_ndbm test_devpoll test_doctest
test_docxmlrpc test_dtrace test_embed test_epoll test_faulthandler
test_fcntl test_file_eintr test_fork1 test_ftplib test_gdb
test_grp test_gzip test_httplib test_httpservers test_idle
test_imaplib test_interpreters test_ioctl test_kqueue
test_launcher test_lzma test_mailbox test_mmap test_msilib
test_multiprocessing_fork test_multiprocessing_forkserver
test_multiprocessing_main_handling test_multiprocessing_spawn
test_nis test_openpty test_ossaudiodev test_pdb test_peg_generator
test_perf_profiler test_pipes test_poll test_poplib test_pty
test_pwd test_queue test_readline test_regrtest test_repl
test_resource test_select test_selectors test_smtplib test_smtpnet
test_socket test_socketserver test_spwd test_sqlite3 test_ssl
test_stable_abi_ctypes test_startfile test_subprocess
test_sys_settrace test_syslog test_tcl test_telnetlib test_thread
test_threadedtempfile test_threading test_threading_local test_tix
test_tkinter test_tools test_ttk test_ttk_textonly test_turtle
test_urllib test_urllib2 test_urllib2_localnet test_urllib2net
test_urllib_response test_urllibnet test_venv test_wait3
test_wait4 test_webbrowser test_winconsoleio test_winreg
test_winsound test_wmi test_wsgiref test_xmlrpc test_xmlrpc_net
test_xxlimited test_zipfile64 test_zipimport_support test_zlib
test_zoneinfo
0:04:52 load avg: 3.32
0:04:52 load avg: 3.32 Re-running failed tests is not supported with --python host runner option.

Total duration: 4 min 52 sec

Click to see traceback logs
remote: Enumerating objects: 20, done.        
remote: Counting objects:   5% (1/20)        
remote: Counting objects:  10% (2/20)        
remote: Counting objects:  15% (3/20)        
remote: Counting objects:  20% (4/20)        
remote: Counting objects:  25% (5/20)        
remote: Counting objects:  30% (6/20)        
remote: Counting objects:  35% (7/20)        
remote: Counting objects:  40% (8/20)        
remote: Counting objects:  45% (9/20)        
remote: Counting objects:  50% (10/20)        
remote: Counting objects:  55% (11/20)        
remote: Counting objects:  60% (12/20)        
remote: Counting objects:  65% (13/20)        
remote: Counting objects:  70% (14/20)        
remote: Counting objects:  75% (15/20)        
remote: Counting objects:  80% (16/20)        
remote: Counting objects:  85% (17/20)        
remote: Counting objects:  90% (18/20)        
remote: Counting objects:  95% (19/20)        
remote: Counting objects: 100% (20/20)        
remote: Counting objects: 100% (20/20), done.        
remote: Compressing objects:   7% (1/14)        
remote: Compressing objects:  14% (2/14)        
remote: Compressing objects:  21% (3/14)        
remote: Compressing objects:  28% (4/14)        
remote: Compressing objects:  35% (5/14)        
remote: Compressing objects:  42% (6/14)        
remote: Compressing objects:  50% (7/14)        
remote: Compressing objects:  57% (8/14)        
remote: Compressing objects:  64% (9/14)        
remote: Compressing objects:  71% (10/14)        
remote: Compressing objects:  78% (11/14)        
remote: Compressing objects:  85% (12/14)        
remote: Compressing objects:  92% (13/14)        
remote: Compressing objects: 100% (14/14)        
remote: Compressing objects: 100% (14/14), done.        
remote: Total 14 (delta 12), reused 0 (delta 0), pack-reused 0        
From https://github.com/python/cpython
 * branch                  main       -> FETCH_HEAD
Note: switching to 'c5c40773cbadc8c35212877ea315a375f3bfaa4b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at c5c40773cb gh-94808: add tests covering `PySequence_{Set,Del}Slice` (GH-99123)
Switched to and reset branch 'main'

../../Objects/obmalloc.c:1450:1: warning: always_inline function might not be inlinable [-Wattributes]
 1450 | arena_map_get(block *p, int create)
      | ^~~~~~~~~~~~~

configure: WARNING: using cross tools not prefixed with host triplet

../../Python/pytime.c:297:10: warning: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion]
    if (!_Py_InIntegralTypeRange(time_t, intpart)) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/internal/pycore_pymath.h:72:45: note: expanded from macro '_Py_InIntegralTypeRange'
    (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type))
                                         ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/internal/pycore_pymath.h:61:88: note: expanded from macro '_Py_IntegralTypeMax'
    (_Py_IS_TYPE_SIGNED(type) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0)
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
../../Python/pytime.c:352:14: warning: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion]
        if (!_Py_InIntegralTypeRange(time_t, intpart)) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/internal/pycore_pymath.h:72:45: note: expanded from macro '_Py_InIntegralTypeRange'
    (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type))
                                         ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/internal/pycore_pymath.h:61:88: note: expanded from macro '_Py_IntegralTypeMax'
    (_Py_IS_TYPE_SIGNED(type) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0)
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
../../Python/pytime.c:518:10: warning: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion]
    if (!_Py_InIntegralTypeRange(_PyTime_t, d)) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/internal/pycore_pymath.h:72:45: note: expanded from macro '_Py_InIntegralTypeRange'
    (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type))
                                         ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/internal/pycore_pymath.h:61:88: note: expanded from macro '_Py_IntegralTypeMax'
    (_Py_IS_TYPE_SIGNED(type) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0)
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
3 warnings generated.
../../Modules/expat/xmlparse.c:3116:9: warning: code will never be executed [-Wunreachable-code]
        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,
        ^~~~~~
../../Modules/expat/xmlparse.c:3115:16: note: silence by adding parentheses to mark code as explicitly dead
      else if (0 && parser->m_characterDataHandler)
               ^
               /* DISABLES CODE */ ( )
../../Modules/expat/xmlparse.c:4059:9: warning: code will never be executed [-Wunreachable-code]
        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,
        ^~~~~~
../../Modules/expat/xmlparse.c:4058:16: note: silence by adding parentheses to mark code as explicitly dead
      else if (0 && parser->m_characterDataHandler)
               ^
               /* DISABLES CODE */ ( )
../../Modules/expat/xmlparse.c:7703:11: warning: format specifies type 'int' but the argument has type 'ptrdiff_t' (aka 'long') [-Wformat]
          bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP",
          ^~~~~~~~~
3 warnings generated.
../../Modules/timemodule.c:151:13: warning: code will never be executed [-Wunreachable-code]
            PyErr_SetString(PyExc_OverflowError,
            ^~~~~~~~~~~~~~~
../../Modules/timemodule.c:1958:13: warning: incompatible pointer to integer conversion passing 'const struct __clockid *' to parameter of type 'long' [-Wint-conversion]
        if (PyModule_AddIntMacro(module, CLOCK_REALTIME) < 0) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/modsupport.h:59:69: note: expanded from macro 'PyModule_AddIntMacro'
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant((m), #c, (c))
                                                                    ^~~
../../Include/modsupport.h:51:71: note: passing argument to parameter here
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
                                                                      ^
../../Modules/timemodule.c:1965:13: warning: incompatible pointer to integer conversion passing 'const struct __clockid *' to parameter of type 'long' [-Wint-conversion]
        if (PyModule_AddIntMacro(module, CLOCK_MONOTONIC) < 0) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/modsupport.h:59:69: note: expanded from macro 'PyModule_AddIntMacro'
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant((m), #c, (c))
                                                                    ^~~
../../Include/modsupport.h:51:71: note: passing argument to parameter here
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
                                                                      ^
../../Modules/timemodule.c:1982:13: warning: incompatible pointer to integer conversion passing 'const struct __clockid *' to parameter of type 'long' [-Wint-conversion]
        if (PyModule_AddIntMacro(module, CLOCK_PROCESS_CPUTIME_ID) < 0) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/modsupport.h:59:69: note: expanded from macro 'PyModule_AddIntMacro'
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant((m), #c, (c))
                                                                    ^~~
../../Include/modsupport.h:51:71: note: passing argument to parameter here
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
                                                                      ^
../../Modules/timemodule.c:1988:13: warning: incompatible pointer to integer conversion passing 'const struct __clockid *' to parameter of type 'long' [-Wint-conversion]
        if (PyModule_AddIntMacro(module, CLOCK_THREAD_CPUTIME_ID) < 0) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Include/modsupport.h:59:69: note: expanded from macro 'PyModule_AddIntMacro'
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant((m), #c, (c))
                                                                    ^~~
../../Include/modsupport.h:51:71: note: passing argument to parameter here
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
                                                                      ^
5 warnings generated.
cat: pybuilddir.txt: No such file or directory

make: *** [Makefile:1846: buildbottest] Error 2

Cannot open file '/opt/buildbot/bcannon-wasm/3.x.bcannon-wasm.wasi/build/build/build_oot/host/test-results.xml' for upload

@sobolevn
Copy link
Member Author

sobolevn commented Nov 5, 2022

I've seen the buildbot failure. Going to monitor other builds: if they have the same problem, I will fix it.

Thanks for the merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants