Skip to content

Deleting a key from a dictionary while iterating over it raises an exception in Python 3 #1998

Closed
arsdragonfly/node-gyp
#1
@tacchinotacchi

Description

@tacchinotacchi

The problem is at line

# Now drop all the abstract ones.

In Python 3, it's not allowed to delete a key from a dictionary while iterating over it.
Example while trying to npm install --save gl:

> gl@4.4.0 install /home/alex/Documents/code/editor-renderer/node_modules/gl
> prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=13.3.0 runtime=node arch=x64 libc= platform=linux)
Traceback (most recent call last):
  File "/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
    return gyp_main(args)
  File "/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 520, in gyp_main
    [generator, flat_list, targets, data] = Load(
  File "/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 136, in Load
    result = gyp.input.Load(build_files, default_variables, includes[:],
  File "/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2868, in Load
    SetUpConfigurations(target, target_dict)
  File "/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2289, in SetUpConfigurations
    for configuration in target_dict['configurations'].keys():
RuntimeError: dictionary changed size during iteration
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:219:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
gyp ERR! System Linux 4.19.88-1-MANJARO
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/alex/Documents/code/editor-renderer/node_modules/gl
gyp ERR! node -v v13.3.0
gyp ERR! node-gyp -v v6.0.1
gyp ERR! not ok 
npm WARN editor-renderer@0.0.1 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gl@4.4.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the gl@4.4.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/alex/.npm/_logs/2019-12-16T14_48_26_168Z-debug.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions