Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Open
Description
[edit by@encukou, May 2024] The coverage report and checklist are outdated.Run coverage locally before contributing.
This bug is going to be used to track work in a other bugs to improve the C-level coverage of the CPython test suite.
There is a set ofbaseline coverage results on main [edit: outdated, see above] that can be used to find coverage gaps.
The plan,discussed on discuss.python.org is as follows:
- Read through the coverage report and record any notable gaps in the checklist below. The goal is not 100% coverage, and each area of improvement will probably require some judgement calls. For example, covering all cases where memory exhaustion can occur is probably not worth the effort. On the other hand, detailed coverage in the eval loop may be worth the effort.
- When someone has "read through" a particular source file and added created subitems for any interesting gaps, they should check it off on the list below and add links to any issues created.
Related work:
There isrelated work to publish coverage results from CPython on a regular basis, but this issue is concerned with using those results to actually reduce our gaps in coverage.
List of source files:
Include/internal/pycore_asdl.hInclude/internal/pycore_bitutils.hInclude/internal/pycore_call.hInclude/internal/pycore_code.hInclude/internal/pycore_frame.hInclude/internal/pycore_moduleobject.hInclude/internal/pycore_object.hInclude/internal/pycore_pymath.hInclude/internal/pycore_pymem.hInclude/internal/pycore_pystate.hInclude/object.hInclude/pydtrace.hObjects/abstract.c- Buffer related functions:
PyBuffer_FromContiguous,PyObject_CopyData,PyBuffer_FillContiguousStrides PyNumber_Checkdoesn't testcomplexPySequence_RepeatandPySequence_InPlaceRepeathave no coveragePySequence_SetItemwith a negative index is untestedPySequence_SetSliceandPySequence_DelSliceare untestedPyMapping_HasKeyandPyMapping_HasKeyStringare untested
- Buffer related functions:
Objects/accu.cObjects/boolobject.cObjects/bytearrayobject.cObjects/bytes_methods.cObjects/bytesobject.cInIt's only the case where the underlying libc is broken that isn't tested.PyBytes_FromFormatV, the special handling of%pisn't tested.- gh-94808: Improve coverage of _PyBytes_FormatEx #95895
Objects/call.cPyEval_CallObjectWithKeywordshas no coverage_PyObject_CallMethodId_SizeThas no coverage
Objects/capsule.cObjects/cellobject.cObjects/classobject.cObjects/codeobject.cObjects/complexobject.cObjects/descrobject.cObjects/dictobject.c- In
dictresizeconvert split table into new combined table" is uncovered. _PyDict_GetItemHinthas no coverage
- In
Objects/enumobject.cObjects/exceptions.cObjects/fileobject.cPyFile_FromFdhas no coveragePyFile_GetLineoverbytesinput has no coverage
Objects/floatobject.cObjects/frameobject.c- frame_setlineno has poor coverage in its helper functionsget_arg andmark_stacks.
- _PyFrame_GetState has a switch statement where only the default case is covered.
- In_PyFrame_FastToLocalsWithError there is no test that exercises the COPY_FREE_VARS case.
Objects/funcobject.c- A bunch of API is untested:
PyFunction_GetCode,PyFunction_GetGlobals,PyFunction_GetModule,PyFunction_GetDefaults,PyFunction_SetDefaults,PyFunction_GetKwDefaults,PyFunction_SetKwDefaults,PyFunction_GetClosure,PyFunction_SetClosure,PyFunction_GetAnnotations,PyFunction_SetAnnotations\ - gh-94808: cover
PyFunction_GetDefaultsandPyFunction_SetDefaults#98449 - [3.11] gh-94808: Cover
PyFunction_GetCode,PyFunction_GetGlobals,… #98317
- A bunch of API is untested:
Objects/genericaliasobject.cObjects/genobject.cgen_new_with_qualnameand APIPyGen_NewWithQualNameandPyGen_Newhave no coverage.PyCoro_Newhas no coveragePyAsyncGen_Newhas no coverageasync_gen_athrow_sendhas poor coverage
Objects/interpreteridobject.cObjects/iterobject.cObjects/listobject.cObjects/longobject.c_PyLong_Sing_t_Converterhas no coveragelong_format_binarydoesn't test outputting to UCS2 or UCS4int_bit_length_implandint_bit_count_impldoesn't cover the case whereexpression overflows
Objects/memoryobject.cinit_sliceisnot well-covered
Objects/methodobject.cObjects/moduleobject.cPyModule_GetFilenamehas no coverage
Objects/namespaceobject.cObjects/object.cPyObject_Printhas no coveragePyObject_Bytesdoes not test the case where there is a__bytes__- gh-94808: Add test coverage for PyObject_HasAttrString #96627
PyObject_SetAttrStringdoesn't test when object has atp_setattrPyObject_GetAttrStringdoesn't test when object has atp_getattr_PyObject_LookupAttrdoesn't test when object has atp_getattr
Objects/obmalloc.cObjects/odictobject.cObjects/picklebufobject.cPyPickleBuffer_FromObject,PyPickleBuffer_Releasehas no coverage
Objects/rangeobject.cObjects/setobject.cObjects/sliceobject.cPySlice_GetIndices/PySlice_GetIndicesExhas no coverage
Objects/stringlib/codecs.hObjects/stringlib/count.hObjects/stringlib/ctype.hObjects/stringlib/eq.hObjects/stringlib/fastsearch.hObjects/stringlib/find.hObjects/stringlib/find_max_char.hObjects/stringlib/join.hObjects/stringlib/localeutil.hObjects/stringlib/partition.hObjects/stringlib/replace.hObjects/stringlib/split.hObjects/stringlib/transmogrify.hObjects/stringlib/undef.hObjects/stringlib/unicode_format.hObjects/structseq.cObjects/tupleobject.cObjects/typeobject.cwrap_sq_setitemhas no coverage
Objects/unicodectype.cObjects/unicodeobject.cxmlcharrefreplacedoesn't test for codepoints < 100 (This seems almost impossible to occur).resize_inplacehas no coverageunicode_kind_namewhen!PyUnicode_IS_COMPACTisn't covered --low priority used by consistency check onlyunicode_write_cstrdoesn't test writing into UCS2 or UCS4- gh-94808: Cover
%pinPyUnicode_FromFormat#96677 PyUnicode_AsDecodedObject,PyUnicode_AsDecodedUnicode,PyUnicode_AsEncodedObject,PyUnicode_AsEncodedUnicodehas no coverage_Py_DecodeUTF8Exand_Py_EncodeUTF8Exhas no coverage forerror == surrogateescapePyUnicode_BuildEncodingMapdoesn't handle theneed_dictcaseucs1lib_find_sliceanducs1lib_rfind_slicearen't covered.PyUnicode_Counthas no coverage- gh-94808: Cover
str.rsplitfor UCS1, UCS2 or UCS4 #98228 PyUnicode_CompareWithASCIIStringhas no coverage for comparing with UCS2 or UCS4_PyUnicode_EqualToASCIIIdhas no coverage
Objects/unicodetype_db.hObjects/unionobject.cObjects/weakrefobject.cParser/action_helpers.c_PyPegen_set_expr_contextdoesn't cover "starred kind"_PyPegen_get_expr_nameswitch statement coverage is non-exhaustive
Parser/myreadline.c(N/A Windows-only)Parser/parser.cParser/peg_api.cParser/pegen.cParser/pegen.hParser/pegen_errors.cParser/string_parser.cParser/tokenizer.c- [coverage] tokenizer.c: valid_utf8 #94823
- tokenizer.c seems to have no coverage for a few functions related to interactive usage, e.g.tok_underflow_interactive andtok_concatenate_interactive_newline.
Generated codePython/Python-ast.cPython/Python-tokenize.cPython/_warnings.cshow_warningdoesn't cover the case where there is asourceline.PyErr_WarnExplicithas no coverage
Python/asdl.cPython/ast.censure_literal_*functions aren't coveredvalidate_pattern_match_valuedoesn't cover all elements of switch
Python/ast_opt.ccheck_complexitydoesn't cover thefrozensetcaseast_foldbodyisn't covered
Python/ast_unparse.cPython/bltinmodule.cPython/bootstrap_hash.cPython/ceval.cPyEval_AquireLockandPyEval_ReleaseLockare uncovered- gh-94808: Coverage: __build_class__ inside a non-dict __builtins__ #95932
STORE_ATTR_WITH_HINTdoesn't cover thecase where the dictionary doesn't have Unicode keysCALL_FUNCTION_EXdoesn't cover the case where kwargs isnot an exact dictPyEval_EvalCodeExdoesn't cover the case wherekwargs are passed inPyEval_GetFramehas no coverage- gh-94808: Cover
PyEval_GetFuncDescfunction #98300
Python/ceval_gil.hPython/codecs.cPython/compile.c- write_instr is not handling the case where ilen > 2. It might be that those are never seen in practice...? If so, feel free to close this bug.
- check_ann_subscr doesn't have any coverage for slice or tuple kinds.
- optimize_basic_block has some opcodes that aren't covered in the JUMP_IF_FALSE_OR_POP and the JUMP_IF_TRUE_OR_POP cases.
Python/condvar.hPython/context.cPyContext_Copy,PyContext_Enter,PyContext_Exithave no coverage
Python/deepfreeze/deepfreeze.cPython/dtoa.cPython/dup2.cPython/dynamic_annotations.cPython/errors.cPython/fileutils.cis_valid_wide_chardoesn't test error branchesencode_ascii/decode_asciihas no coverage (probably very low priority -- comment says only for platforms with a broken mbstowcs (FreeBSD, OpenIndiana)_Py_stathas no coverage
Python/formatter_unicode.cPython/frame.cPython/frozenmain.cPython/future.cPython/getargs.cPython/getopt.cPython/hamt.cPython/hashtable.cPython/import.cPython/importdl.cPython/initconfig.cPython/marshal.cPython/modsupport.cPython/mysnprintf.cPython/mystrtoul.cPython/pathconfig.cPython/preconfig.cPython/pyarena.cPython/pyfpe.cPython/pyhash.cPython/pylifecycle.cPython/pystate.cPython/pystrcmp.cPython/pystrhex.cPython/pystrtod.cPython/pythonrun.cPython/pytime.cPython/specialize.cPython/structmember.cPython/suggestions.cPython/symtable.cPython/sysmodule.cPython/thread.cPython/traceback.c- tracebacks with angle-bracketed filenames[coverage ] Missing test for tracebacks with angle bracketed filename #95259
- tb_printinternal with
depth > limit _PyTraceBack_Print_Indentedwith overflowingtracebacklimit- No coverage for
_Py_DumpDecimal,_Py_DumpHexadecimal,_Py_DumpASCII,dump_frame,dump_traceback,_Py_DumpTraceback,write_thread_id,_Py_DumpTracebackThreads-- possibly they have tests which are disabled under some circumstances.