snoopyjc / pythonizer

Automatic translator from Perl to Python
https://snoopyjc.org/pythonizer/
Artistic License 2.0
12 stars 1 forks source link

Copies of @_ need to be autovivified #348

Closed snoopyjc closed 1 year ago

snoopyjc commented 1 year ago

Copies of @_ need to be autovivified. For example (from Date::Manip::Obj):

sub new {
   my(@args)    = @_;
   ...
   $class = shift(@args);
   if (ref($args[0]) =~ /^Date::Manip/) {...}

The reference to $args[0] raises an IndexError exception if $args is an empty list instead of creating the element out of whole cloth.

snoopyjc commented 1 year ago

Fixed in v1.030