GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-106078: Suppress the warning caused by multi-phase initialization of `decimal` by CharlieZhao95 · Pull Request #107524 · python/cpython

Conversation

@CharlieZhao95

@CharlieZhao95 CharlieZhao95 commented Aug 1, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
>>> python -m test test_decimal
Running Release|x64 interpreter...
0:00:00 Run tests sequentially
0:00:00 [1/1] test_decimal
...: warning: mpd_setminalloc: ignoring request to set MPD_MINALLOC a second time

This warnning is caused by the multi-phase initialization of decimal module. When decimal module is repeatedly imported, decimal_exec will be executed multiple times and this warning will be raised.

See #107287 (comment) for details.

  • Issue: Isolate the _decimal extension module #106078

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
CharlieZhao95 added 2 commits August 1, 2023 10:12
@CharlieZhao95
Suppress mpd_setminalloc warning
c0bf5f4
@CharlieZhao95
Update ignored.tsv
473eed1
@bedevere-bot bedevere-bot mentioned this pull request Aug 1, 2023
Isolate the _decimal extension module #106078
Closed
14 tasks done
@CharlieZhao95

CharlieZhao95 commented Aug 1, 2023

Copy link
Copy Markdown
Contributor Author

Maybe we can skip news for this PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@CharlieZhao95

CharlieZhao95 commented Aug 1, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

It looks like the global variable check is failing, the tool cannot ignore static variables inside functions. Adding
__attribute__((constructor)) might be a more elegant option.

Forget this. Unfortunately, there is no equivalent for __attribute__((constructor)) on Windows.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

CharlieZhao95 added 2 commits August 1, 2023 11:35
@CharlieZhao95
Add constructor attribute
20ea76e
@CharlieZhao95
Move minalloc_is_set outside
ed8a2b3
@CharlieZhao95
CharlieZhao95 marked this pull request as ready for review August 1, 2023 08:38
@CharlieZhao95
CharlieZhao95 requested a review from rhettinger as a code owner August 1, 2023 08:38
@bedevere-bot bedevere-bot added the awaiting review label Aug 1, 2023
@rhettinger
rhettinger removed their request for review August 3, 2023 14:51
@Eclips4 Eclips4 added the skip news label Aug 8, 2023
Eclips4
Eclips4 reviewed Aug 8, 2023
View reviewed changes
Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@CharlieZhao95
Fix suppression
ff0054b
Eclips4
Eclips4 approved these changes Aug 9, 2023
View reviewed changes

@Eclips4 Eclips4 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I've tested it locally, and it works. Multiple imports of decimal doesn't make any warnings anymore.
LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

CharlieZhao95 reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Aug 9, 2023
@AlexWaygood
AlexWaygood requested a review from erlend-aasland October 3, 2023 09:42
@AlexWaygood

AlexWaygood commented Oct 3, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The warning that's being suppressed here was recently brought up again in #110266

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood AlexWaygood mentioned this pull request Oct 3, 2023
Build warnings - October 2023 #110266
Closed
@AlexWaygood
AlexWaygood requested a review from kumaraditya303 October 3, 2023 09:45
@AlexWaygood
Merge branch 'main' into decimal/suppress_warning
7f87f4b
@erlend-aasland

erlend-aasland commented Oct 3, 2023

Copy link
Copy Markdown
Contributor

See also the discussion about a global init/exit API for extension modules.

CharlieZhao95 reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland approved these changes Oct 3, 2023
View reviewed changes
@AlexWaygood
AlexWaygood merged commit de10522 into python:main Oct 6, 2023
@bedevere-app bedevere-app Bot removed the awaiting core review label Oct 6, 2023
@bedevere-bot

bedevere-bot commented Oct 7, 2023

Copy link
Copy Markdown

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

Hi! The buildbot s390x RHEL7 LTO + PGO 3.x has failed when building commit de10522.

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/244/builds/5628) and take a look at the build logs.
  4. Check if the failure is related to this commit (de10522) 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/244/builds/5628

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

==

Click to see traceback logs
Note: checking out 'de1052245f67d5c5a5dbb4f39449f7687f58fd78'.

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 performing another checkout.

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

  git checkout -b new_branch_name

HEAD is now at de10522... gh-106078: Suppress the warning caused by multi-phase initialization of `decimal` (#107524)
Switched to and reset branch 'main'

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[2]: [clean-retain-profile] Error 1 (ignored)
Python/instrumentation.c: In function ‘allocate_instrumentation_data’:
Python/instrumentation.c:1497:9: warning: missing braces around initializer [-Wmissing-braces]
         code->_co_monitoring->local_monitors = (_Py_LocalMonitors){ 0 };
         ^
Python/instrumentation.c:1497:9: warning: (near initialization for ‘(anonymous).tools’) [-Wmissing-braces]
Python/instrumentation.c:1498:9: warning: missing braces around initializer [-Wmissing-braces]
         code->_co_monitoring->active_monitors = (_Py_LocalMonitors){ 0 };
         ^
Python/instrumentation.c:1498:9: warning: (near initialization for ‘(anonymous).tools’) [-Wmissing-braces]
Objects/bytes_methods.c: In function ‘find_internal’:
Objects/bytes_methods.c:526:31: warning: ‘subobj’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (PyObject_GetBuffer(subobj, &subbuf, PyBUF_SIMPLE) != 0)
                               ^
Objects/bytes_methods.c: In function ‘_Py_bytes_find’:
Objects/bytes_methods.c:526:31: warning: ‘subobj’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Objects/bytes_methods.c:513:15: note: ‘subobj’ was declared here
     PyObject *subobj;
               ^
Objects/bytes_methods.c: In function ‘_Py_bytes_rfind’:
Objects/bytes_methods.c:526:31: warning: ‘subobj’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (PyObject_GetBuffer(subobj, &subbuf, PyBUF_SIMPLE) != 0)
                               ^
Objects/bytes_methods.c:513:15: note: ‘subobj’ was declared here
     PyObject *subobj;
               ^
Objects/bytes_methods.c: In function ‘_Py_bytes_count’:
Objects/bytes_methods.c:675:31: warning: ‘sub_obj’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (PyObject_GetBuffer(sub_obj, &vsub, PyBUF_SIMPLE) != 0)
                               ^
Python/instrumentation.c: In function ‘allocate_instrumentation_data’:
Python/instrumentation.c:1497:9: warning: missing braces around initializer [-Wmissing-braces]
         code->_co_monitoring->local_monitors = (_Py_LocalMonitors){ 0 };
         ^
Python/instrumentation.c:1497:9: warning: (near initialization for ‘(anonymous).tools’) [-Wmissing-braces]
Python/instrumentation.c:1498:9: warning: missing braces around initializer [-Wmissing-braces]
         code->_co_monitoring->active_monitors = (_Py_LocalMonitors){ 0 };
         ^
Python/instrumentation.c:1498:9: warning: (near initialization for ‘(anonymous).tools’) [-Wmissing-braces]
Python/pytime.c: In function ‘pytime_mul’:
Python/pytime.c:1388:1: note: correcting inconsistent profile data
 }
 ^
./Modules/_io/clinic/fileio.c.h: In function ‘_io_FileIO_close’:
./Modules/_io/fileio.c:175:32: warning: ‘exc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         _PyErr_ChainExceptions1(exc);
                                ^
./Modules/_io/fileio.c:160:15: note: ‘exc’ was declared here
     PyObject *exc;
               ^
./Modules/_io/clinic/textio.c.h: In function ‘_io_TextIOWrapper_seek’:
./Modules/_io/textio.c:2601:45: warning: ‘MEM[(char * {ref-all})&cookie + 20B]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         decoded = PyObject_CallMethodObjArgs(self->decoder, &_Py_ID(decode),
                                             ^
./Modules/_io/textio.c:2452:17: note: ‘MEM[(char * {ref-all})&cookie + 20B]’ was declared here
     cookie_type cookie;
                 ^
./Modules/_io/textio.c:2610:54: warning: ‘MEM[(char * {ref-all})&cookie + 16B]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (PyUnicode_GetLength(self->decoded_chars) < cookie.chars_to_skip) {
                                                      ^
./Modules/_io/textio.c:2452:17: note: ‘MEM[(char * {ref-all})&cookie + 16B]’ was declared here
     cookie_type cookie;
                 ^
./Modules/_io/textio.c:2420:40: warning: ‘MEM[(char * {ref-all})&cookie + 8B]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     return _textiowrapper_encoder_reset(
                                        ^
./Modules/_io/textio.c:2452:17: note: ‘MEM[(char * {ref-all})&cookie + 8B]’ was declared here
     cookie_type cookie;
                 ^
./Modules/_io/textio.c:2420:40: warning: ‘MEM[(char * {ref-all})&cookie]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     return _textiowrapper_encoder_reset(
                                        ^
./Modules/_io/textio.c:2452:17: note: ‘MEM[(char * {ref-all})&cookie]’ was declared here
     cookie_type cookie;
                 ^

make: *** [buildbottest] Error 5
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@CharlieZhao95 @Glyphack
pythongh-106078: Suppress the warning caused by multi-phase initializ…
56a89cb
…ation of `decimal` (python#107524)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@erlend-aasland erlend-aasland erlend-aasland approved these changes
@Eclips4 Eclips4 Eclips4 approved these changes
@kumaraditya303 kumaraditya303 Awaiting requested review from kumaraditya303

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@CharlieZhao95 @AlexWaygood @erlend-aasland @bedevere-bot @Eclips4
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.